{"record":{"id":"00e389b812eb4e1f","repo":"HKUDS/DeepTutor","slug":"tag-not-found-tag","errorCode":null,"errorMessage":"Tag not found: {tag}","messagePattern":"Tag not found: (.+?)","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"deeptutor/api/routers/skills.py","lineNumber":101,"sourceCode":"@router.post(\"/tags/create\")\nasync def create_tag(payload: CreateTagRequest) -> dict[str, str]:\n    service = get_skill_service()\n    try:\n        tag = service.create_tag(payload.name)\n    except TagExistsError as exc:\n        raise HTTPException(status_code=409, detail=f\"Tag already exists: {exc}\")\n    except InvalidTagError as exc:\n        raise HTTPException(status_code=400, detail=str(exc))\n    return {\"name\": tag}\n\n\n@router.put(\"/tags/{tag}\")\nasync def rename_tag(tag: str, payload: RenameTagRequest) -> dict[str, str]:\n    service = get_skill_service()\n    try:\n        new_tag = service.rename_tag(tag, payload.rename_to)\n    except TagNotFoundError:\n        raise HTTPException(status_code=404, detail=f\"Tag not found: {tag}\")\n    except TagExistsError as exc:\n        raise HTTPException(status_code=409, detail=f\"Tag already exists: {exc}\")\n    except InvalidTagError as exc:\n        raise HTTPException(status_code=400, detail=str(exc))\n    return {\"name\": new_tag}\n\n\n@router.delete(\"/tags/{tag}\")\nasync def delete_tag(tag: str) -> dict[str, str]:\n    service = get_skill_service()\n    try:\n        service.delete_tag(tag)\n    except TagNotFoundError:\n        raise HTTPException(status_code=404, detail=f\"Tag not found: {tag}\")\n    except InvalidTagError as exc:\n        raise HTTPException(status_code=400, detail=str(exc))\n    return {\"status\": \"deleted\", \"name\": tag}\n","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/skills.py#L83-L119","documentation":"Lookup guard in PUT /tags/{tag}: the path tag does not exist in the service, so rename has no target. The message echoes the requested tag so the client can spot stale references.","triggerScenarios":"Thrown at deeptutor/api/routers/skills.py:101 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["GET /tags/list first and rename using an existing tag","Client: on 404, refresh the tag list — the tag may have been renamed or deleted elsewhere","Create the desired tag fresh if the old one is gone and the new name is what you want long-term"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","contentChangedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}