HKUDS/DeepTutor · error · HubError

{self.name}: invalid JSON listing skills

Error message

{self.name}: invalid JSON listing skills

What it means

Raised by list_my_skills when the response body for the skills listing cannot be parsed as JSON (response.json() raises ValueError). The hub returned HTML or empty content instead of the expected {"skills": [...]} object.

Source

Thrown at deeptutor/services/skill/hub.py:510

        pre-filling an upgrade's tagging) — see ``buildMySkills`` on the hub.
        """
        url = f"{self._base_url}/skills"
        try:
            response = self._client.get(
                url, params={"owner": "me"}, headers={"Authorization": f"Bearer {token}"}
            )
        except httpx.HTTPError as exc:
            raise HubError(f"{self.name}: request failed: {exc}") from exc
        if response.status_code in (401, 403):
            raise HubError(
                f"{self.name}: not authenticated — run `skill login` or pass a valid token."
            )
        if response.status_code >= 400:
            raise HubError(f"{self.name}: HTTP {response.status_code}: {response.text[:200]}")
        try:
            payload = response.json()
        except ValueError as exc:
            raise HubError(f"{self.name}: invalid JSON listing skills") from exc
        rows = payload.get("skills") if isinstance(payload, dict) else None
        return [row for row in (rows or []) if isinstance(row, dict)]

    def set_dist_tag(
        self,
        slug: str,
        *,
        version: str,
        token: str,
        tag: str = "latest",
    ) -> dict[str, Any]:
        """Move a dist-tag (default ``latest``) to an existing version (rollback)."""
        url = f"{self._base_url}/skills/{slug}/dist-tags"
        try:
            response = self._client.post(
                url,
                json={"tag": tag, "version": version},
                headers={"Authorization": f"Bearer {token}"},

View on GitHub (pinned to 3e82f13042)

Solutions

  1. Reproduce with curl and inspect the raw body
  2. Fix base_url / proxy configuration
  3. Retry transient failures
  4. If the hub consistently returns non-JSON, report the bug to the hub operator
Defensive patterns

Strategy: try-catch

Validate before calling

resp = httpx.get(f"{BASE}/skills", params={"owner":"me"}, headers=auth)
if "json" not in resp.headers.get("content-type", ""): raise RuntimeError('non-JSON')

Try / catch

try:
    hub.list_my_skills(token)
except HubError as e:
    if "invalid JSON" in str(e): return []
    raise

Prevention

When it happens

Trigger: Calling list_my_skills when an error page, empty body, or plaintext is returned with (or despite) a 2xx/4xx-other status.

Common situations: Proxy or WAF intercepting authenticated requests and returning HTML; misconfigured base_url; hub crash mid-response.

Understand the failure class

Related errors


AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27). Data as JSON: /api/errors/b8de906456f0f9ba. Report an issue: GitHub.