{"record":{"id":"8bce3aef909e98f5","repo":"zylon-ai/private-gpt","slug":"file-file-id-not-found-or-is-a-sandbox-output","errorCode":null,"errorMessage":"File '{file_id}' not found or is a sandbox output (cannot be deleted).","messagePattern":"File '(.+?)' not found or is a sandbox output \\(cannot be deleted\\)\\.","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"private_gpt/server/files/file_service.py","lineNumber":212,"sourceCode":"        canonical = _decode_file_id(file_id)\n        storage_path = _canonical_to_storage_path(canonical)\n        self._validate_file_id(storage_path)\n        _folder, filename = storage_path.split(\"/\", 1)\n        prefix = self._prefix_for_path(storage_path, scope_id)\n        file_info = await storage.stat_file(prefix, filename)\n        if file_info is None:\n            raise HTTPException(status_code=404, detail=f\"File '{file_id}' not found.\")\n        content = await storage.read_file(prefix, filename)\n        display_name = canonical.split(\"/\")[-1]\n        return content, file_info.mime_type, display_name\n\n    async def delete_file(self, scope_id: str, file_id: str) -> DeletedFile:\n        storage = self._require_storage()\n        canonical = _decode_file_id(file_id)\n        storage_path = _canonical_to_storage_path(canonical)\n        self._validate_file_id(storage_path)\n        if not storage_path.startswith(\"uploads/\"):\n            raise HTTPException(\n                status_code=404,\n                detail=f\"File '{file_id}' not found or is a sandbox output (cannot be deleted).\",\n            )\n        _folder, filename = storage_path.split(\"/\", 1)\n        deleted = await storage.delete_file(self._uploads_prefix(scope_id), filename)\n        if not deleted:\n            raise HTTPException(\n                status_code=404,\n                detail=f\"File '{file_id}' not found or is a sandbox output (cannot be deleted).\",\n            )\n        return DeletedFile(id=file_id)\n\n    @staticmethod\n    def _validate_file_id(file_id: str) -> None:\n        if \"..\" in file_id.split(\"/\"):\n            raise HTTPException(status_code=400, detail=\"Invalid file ID.\")\n","sourceCodeStart":194,"sourceCodeEnd":229,"githubUrl":"https://github.com/zylon-ai/private-gpt/blob/4a030776a31a901ad80b1bf4d7faa2c1a367efbb/private_gpt/server/files/file_service.py#L194-L229","documentation":"Error \"File '{file_id}' not found or is a sandbox output (cannot be deleted).\" thrown in zylon-ai/private-gpt.","triggerScenarios":"Raised when a delete request references a file_id that does not exist or points to a file produced as sandbox output, which is protected from deletion.","commonSituations":"Attempting to delete a file via the files API with an unknown id, or trying to delete a generated sandbox output file instead of an uploaded one.","solutions":["Verify the file_id exists by listing files before attempting deletion.","Check that the file is not a sandbox output; sandbox output files cannot be deleted.","Ensure you are not deleting a file that was generated as a sandbox output artifact.","Confirm the file belongs to the current session and has not already been deleted."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4a030776a31a901ad80b1bf4d7faa2c1a367efbb","analyzedAt":"2026-08-15T03:51:26.951Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}