{"record":{"id":"55d55e74aa967162","repo":"HKUDS/DeepTutor","slug":"file-not-found","errorCode":null,"errorMessage":"File not found","messagePattern":"File not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"deeptutor/api/routers/knowledge.py","lineNumber":2327,"sourceCode":"            return None\n        raise HTTPException(\n            status_code=409,\n            detail=(\n                f\"Knowledge base '{resolved_name}' is connected to an external resource \"\n                \"and has no local files.\"\n            ),\n        )\n\n    kb_path = manager.get_knowledge_base_path(resolved_name)\n    return kb_path / \"raw\"\n\n\ndef _resolve_kb_raw_file_or_404(kb_name: str, filename: str) -> Path:\n    \"\"\"Resolve a raw KB file while preventing traversal outside raw/.\"\"\"\n    raw_dir = _resolve_kb_raw_dir(kb_name)\n    assert raw_dir is not None  # allow_unsupported=False guarantees a path\n    if not raw_dir.exists():\n        raise HTTPException(status_code=404, detail=\"File not found\")\n\n    raw_resolved = raw_dir.resolve()\n    target = (raw_dir / filename).resolve()\n    try:\n        target.relative_to(raw_resolved)\n    except ValueError:\n        raise HTTPException(status_code=403, detail=\"Access denied\")\n\n    if not target.exists() or not target.is_file():\n        raise HTTPException(status_code=404, detail=\"File not found\")\n\n    return target\n\n\n@router.get(\"/{kb_name}/files\")\nasync def list_kb_raw_files(kb_name: str):\n    \"\"\"List raw documents under <kb>/raw/, recursing into folders.\n","sourceCodeStart":2309,"sourceCodeEnd":2345,"githubUrl":"https://github.com/HKUDS/DeepTutor/blob/3e82f130422a813cdd73c10b21a44e9325f5821a/deeptutor/api/routers/knowledge.py#L2309-L2345","documentation":"Error \"File not found\" thrown in HKUDS/DeepTutor.","triggerScenarios":"Thrown at deeptutor/api/routers/knowledge.py:2327 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3e82f130422a813cdd73c10b21a44e9325f5821a","analyzedAt":"2026-08-27T06:57:25.364Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}