Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(youtube-music): a disabled YouTube Data API names the console page that enables it

rubenluetke10-beepe9618d1e809c
diff --git a/docs/BUGS.md b/docs/BUGS.md
index e1e2f29cf0..8518954bb3 100644
--- a/docs/BUGS.md
+++ b/docs/BUGS.md
@@ -11590,6 +11590,19 @@ wins, then the preferred connected one, then the only connected one). Tests:
``test_bridge_refits_the_declared_set_to_a_new_budget``,
``test_a_music_skill_load_follows_the_only_connected_service``.
+**Last mile on this box (2026-08-22 19:21, after restart).** The live model
+now called ``youtube_music`` for real — and Google answered 403
+``accessNotConfigured``: the YouTube Data API v3 was never enabled in the
+bring-your-own Google Cloud project behind the shared Google OAuth client
+(Gmail/Calendar/Drive worked because THEIR APIs were enabled there). Enabled
+in the console; the first search then returned "Ed Sheeran - Perfect".
+Jarvis had said it honestly ("Problem mit der YouTube-Programmierschnittstelle")
+but without the one click that fixes it, so ``_explain`` now appends Google's
+``activationUrl`` (``error.details[].metadata.activationUrl``) to the
+``_API_DISABLED`` text — the Plugins view shows the direct link, voice scrubs
+the URL as always (``_activation_url``,
+``test_execute_explains_search_quota_api_disabled_and_scope``).
+
**Lesson (BUG-160 family).** A tool result's ``success`` flag says the TOOL
ran, not that the USER'S REQUEST happened. Any tool whose output is
instructions for the model (``run-skill``, ``answer_instruction`` lookups,
diff --git a/jarvis/plugins/tool/youtube_music_rest.py b/jarvis/plugins/tool/youtube_music_rest.py
index 0703b570d3..fcc6b09992 100644
--- a/jarvis/plugins/tool/youtube_music_rest.py
+++ b/jarvis/plugins/tool/youtube_music_rest.py
@@ -605,6 +605,39 @@ class YouTubeMusicRestTool:
return None
return resp.json()
+ @staticmethod
+ def _activation_url(exc: Any) -> str:
+ """The console URL Google attaches to a ``SERVICE_DISABLED`` error, or ``""``.
+
+ Lives in ``error.details[*].metadata.activationUrl`` (ErrorInfo) or in
+ the ``Help`` detail's links. Only ``https://console.`` Google URLs are
+ handed on — the text ends up in a user-facing error string.
+ """
+ try:
+ payload = exc.response.json()
+ except Exception: # noqa: BLE001 — a non-JSON error body carries no link
+ return ""
+ error = payload.get("error") if isinstance(payload, dict) else None
+ details = error.get("details") if isinstance(error, dict) else None
+ if not isinstance(details, list):
+ return ""
+ candidates: list[str] = []
+ for detail in details:
+ if not isinstance(detail, dict):
+ continue
+ metadata = detail.get("metadata")
+ if isinstance(metadata, dict):
+ candidates.append(str(metadata.get("activationUrl") or ""))
+ links = detail.get("links")
+ if isinstance(links, list):
+ for link in links:
+ if isinstance(link, dict):
+ candidates.append(str(link.get("url") or ""))
+ for url in candidates:
+ if url.startswith("https://console.") and "google.com/" in url:
+ return url
+ return ""
+
@staticmethod
def _reason(exc: Any) -> str:
"""Google's machine-readable failure reason (``quotaExceeded``,
@@ -1115,6 +1148,14 @@ class YouTubeMusicRestTool:
return _SEARCH_QUOTA
return _QUOTA
if reason in ("accessNotConfigured", "SERVICE_DISABLED"):
+ # Google names the exact console page for the project
+ # behind the OAuth client; hand it on, so the Plugins view
+ # shows the one click that fixes it (live 2026-08-22
+ # 19:21: the bring-your-own project had Gmail enabled and
+ # YouTube not, and the user heard only "API problem").
+ activation = cls._activation_url(exc)
+ if activation:
+ return f"{_API_DISABLED} Direct link: {activation}"
return _API_DISABLED
if reason in ("insufficientPermissions", "forbidden", "PERMISSION_DENIED"):
return _NO_SCOPE
diff --git a/tests/unit/plugins/tool/test_youtube_music_rest.py b/tests/unit/plugins/tool/test_youtube_music_rest.py
index 17c4a546c1..20fbb75b80 100644
--- a/tests/unit/plugins/tool/test_youtube_music_rest.py
+++ b/tests/unit/plugins/tool/test_youtube_music_rest.py
@@ -675,6 +675,38 @@ async def test_execute_explains_search_quota_api_disabled_and_scope():
res = await _tool(disabled).execute({"action": "list_playlists"}, ctx=None) # type: ignore[arg-type]
assert "not enabled" in res.error
+ # Live 2026-08-22 19:21: Google's SERVICE_DISABLED error names the exact
+ # console page for the project behind the bring-your-own OAuth client.
+ # The link travels with the error so the Plugins view shows the one click.
+ activation = (
+ "https://console.developers.google.com/apis/api/youtube.googleapis.com/"
+ "overview?project=940985062784"
+ )
+
+ def disabled_with_link(request: httpx.Request) -> httpx.Response:
+ return httpx.Response(
+ 403,
+ json={
+ "error": {
+ "code": 403,
+ "message": "YouTube Data API v3 has not been used in project …",
+ "errors": [{"reason": "accessNotConfigured", "domain": "usageLimits"}],
+ "status": "PERMISSION_DENIED",
+ "details": [
+ {
+ "@type": "type.googleapis.com/google.rpc.ErrorInfo",
+ "reason": "SERVICE_DISABLED",
+ "metadata": {"activationUrl": activation},
+ }
+ ],
+ }
+ },
+ )
+
+ res = await _tool(disabled_with_link).execute({"action": "list_playlists"}, ctx=None) # type: ignore[arg-type]
+ assert "not enabled" in res.error
+ assert activation in res.error
+
def scope(request: httpx.Request) -> httpx.Response:
return _google_error(403, "insufficientPermissions")