{"record":{"id":"d2b2a5d9bad3afe2","repo":"JuliusBrussee/caveman","slug":"file-not-found-filepath","errorCode":null,"errorMessage":"File not found: {filepath}","messagePattern":"File not found: (.+?)","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"plugins/caveman/skills/caveman-compress/scripts/compress.py","lineNumber":282,"sourceCode":"ORIGINAL (reference only):\n{original}\n\nCOMPRESSED (fix this):\n{compressed}\n\nReturn ONLY the fixed compressed file. No explanation.\n\"\"\"\n\n\n# ---------- Core Logic ----------\n\n\ndef compress_file(filepath: Path) -> bool:\n    # Resolve and validate path\n    filepath = filepath.resolve()\n    MAX_FILE_SIZE = 500_000  # 500KB\n    if not filepath.exists():\n        raise FileNotFoundError(f\"File not found: {filepath}\")\n    if filepath.stat().st_size > MAX_FILE_SIZE:\n        raise ValueError(f\"File too large to compress safely (max 500KB): {filepath}\")\n\n    # Refuse files that look like they contain secrets or PII. Compressing ships\n    # the raw bytes to the Anthropic API — a third-party boundary — so we fail\n    # loudly rather than silently exfiltrate credentials or keys. Override is\n    # intentional: the user must rename the file if the heuristic is wrong.\n    if is_sensitive_path(filepath):\n        raise ValueError(\n            f\"Refusing to compress {filepath}: filename looks sensitive \"\n            \"(credentials, keys, secrets, or known private paths). \"\n            \"Compression sends file contents to the Anthropic API. \"\n            \"Rename the file if this is a false positive.\"\n        )\n\n    print(f\"Processing: {filepath}\")\n\n    if not should_compress(filepath):","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/plugins/caveman/skills/caveman-compress/scripts/compress.py#L264-L300","documentation":"Error \"File not found: {filepath}\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at plugins/caveman/skills/caveman-compress/scripts/compress.py:282 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a path to an existing file."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}