{"record":{"id":"84e70aa0ccf4eda3","repo":"ATH-MaaS/Pixelle-Video","slug":"str-e-84e70a","errorCode":null,"errorMessage":"str(e)","messagePattern":"str\\(e\\)","errorType":"http","errorClass":"HTTPException","httpStatus":500,"severity":"error","filePath":"api/routers/files.py","lineNumber":127,"sourceCode":"            '.html': 'text/html',\n            '.json': 'application/json',\n        }\n        media_type = media_types.get(suffix, 'application/octet-stream')\n        \n        # Use inline disposition for browser preview\n        return FileResponse(\n            path=str(abs_path),\n            media_type=media_type,\n            headers={\n                \"Content-Disposition\": f'inline; filename=\"{abs_path.name}\"'\n            }\n        )\n        \n    except HTTPException:\n        raise\n    except Exception as e:\n        logger.error(f\"File access error: {e}\")\n        raise HTTPException(status_code=500, detail=str(e))\n\n","sourceCodeStart":109,"sourceCodeEnd":129,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/api/routers/files.py#L109-L129","documentation":"The GET file handler's outer catch-all: HTTPExceptions are re-raised unchanged, but any other exception during path resolution or file streaming becomes HTTP 500 with str(e) as detail. Typical sources are OS-level errors (PermissionError on the file, OSError) raised while reading the file.","triggerScenarios":"GET to the files endpoint where reading the file raises a non-HTTP error — PermissionError (file owned by another user, mode 000), OSError from IO problems, or a bug between the security checks and FileResponse construction.","commonSituations":"Files created by a container user unreadable by the server process; NFS/permission issues after volume mounting; files with restrictive umask; server running as a different user than the pipeline that wrote outputs.","solutions":["Check the server log 'File access error: ...' to see the underlying OS error.","Fix file permissions (chmod/chown) so the server process can read the file.","Ensure the container/server user matches the user that wrote the outputs, or use a shared group.","Verify the file is readable and not a broken symlink at the resolved path.","Return a sanitized generic 500 detail and log the traceback instead of str(e)."],"exampleFix":"// before\nexcept Exception as e:\n    logger.error(f\"File access error: {e}\")\n    raise HTTPException(status_code=500, detail=str(e))\n// after\nexcept Exception:\n    logger.exception(\"File access error\")\n    raise HTTPException(status_code=500, detail=\"File access failed\")","handlingStrategy":"try-catch","validationCode":"import fs from 'fs';\nconst abs = path.resolve('output', filePath);\ntry { fs.accessSync(abs, fs.constants.R_OK); } catch { throw new Error(`Server process cannot read ${filePath}: check permissions`); }","typeGuard":null,"tryCatchPattern":"try {\n  const res = await fetch(`/api/files/${encodeURIComponent(filePath)}`);\n  if (res.status === 500) throw new Error('File access failed on server — check file permissions and server logs');\n  if (!res.ok) throw new Error(`File fetch failed: ${res.status}`);\n  return await res.blob();\n} catch (err) {\n  logger.error('File fetch failed', err);\n  throw err;\n}","preventionTips":["Align file ownership/permissions between the pipeline writer and the server user.","Use a shared group or matching UID in container deployments.","Watch logs for 'File access error' entries indicating OS-level read failures.","Avoid overly restrictive umasks when writing output artifacts."],"tags":["http-500","filesystem","permissions","generic-error"],"backgroundTag":"file-permission-denied","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}