{"record":{"id":"fa49313a7653e55e","repo":"HKUDS/DeepTutor","slug":"self-name-publish-failed-http-response-status","errorCode":null,"errorMessage":"{self.name}: publish failed (HTTP {response.status_code}): {detail}","messagePattern":"(.+?): publish failed \\(HTTP (.+?)\\): (.+?)","errorType":"http","errorClass":"HubError","httpStatus":null,"severity":"error","filePath":"deeptutor/services/skill/hub.py","lineNumber":481,"sourceCode":"        accepts it. Surfaces the API's JSON ``error`` message on failure.\n        \"\"\"\n        url = f\"{self._base_url}/skills\"\n        try:\n            response = self._client.post(\n                url,\n                data={\"slug\": slug, \"version\": version, **fields},\n                files={\"zip\": (\"package.zip\", zip_bytes, \"application/zip\")},\n                headers={\"Authorization\": f\"Bearer {token}\"},\n            )\n        except httpx.HTTPError as exc:\n            raise HubError(f\"{self.name}: publish request failed: {exc}\") from exc\n        if response.status_code >= 400:\n            detail = \"\"\n            try:\n                detail = str(response.json().get(\"error\") or \"\")\n            except ValueError:\n                detail = response.text[:200]\n            raise HubError(f\"{self.name}: publish failed (HTTP {response.status_code}): {detail}\")\n        try:\n            return response.json()\n        except ValueError:\n            return {}\n\n    def list_my_skills(self, token: str) -> list[dict[str, Any]]:\n        \"\"\"List the authenticated user's skills via ``GET /skills?owner=me``.\n\n        Each row carries the slug, current ``version`` (latest), the full\n        ``versions`` list (for rollback) and the current classification (for\n        pre-filling an upgrade's tagging) — see ``buildMySkills`` on the hub.\n        \"\"\"\n        url = f\"{self._base_url}/skills\"\n        try:\n            response = self._client.get(\n                url, params={\"owner\": \"me\"}, headers={\"Authorization\": f\"Bearer {token}\"}\n            )\n        except httpx.HTTPError as exc:","sourceCodeStart":463,"sourceCodeEnd":499,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/services/skill/hub.py#L463-L499","documentation":"Raised by ClawHubProvider.publish when the hub accepts the request but responds with HTTP >= 400. The message embeds the status code plus the hub's own error detail (JSON 'error' field, or the first 200 chars of the body).","triggerScenarios":"Publishing with an invalid/expired bearer token (401), a slug owned by someone else (403), a version that already exists (409), or validation failures (422) on fields like slug/version.","commonSituations":"Re-publishing the same version instead of bumping it in SKILL.md frontmatter; token minted for a different account; missing required publish fields; slug name collision on the hub.","solutions":["Bump the version in SKILL.md frontmatter (or pass --version) and retry","Re-mint the token on the hub web UI if 401/403","Check ownership of the slug and rename if taken","Fix any field validation errors named in the detail string"],"exampleFix":"# before: version: 1.0.0 already published\n# after (SKILL.md frontmatter):\nversion: 1.0.1","handlingStrategy":"try-catch","validationCode":"# pre-check version novelty where possible\nlisting = hub.detail(slug)\nif listing.get(\"version\") == my_version: bump_version()","typeGuard":null,"tryCatchPattern":"try:\n    hub.publish(slug, version, token, ...)\nexcept HubError as e:\n    if \"HTTP 409\" in str(e): bump_and_retry()\n    elif \"HTTP 401\" in str(e) or \"HTTP 403\" in str(e): relogin()\n    else: raise","preventionTips":["Always bump version before republishing","Mint fresh tokens before publish sessions"],"tags":["publish","http-4xx","version-conflict","hub"],"backgroundTag":"api-request-rejected","analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}