{"record":{"id":"2ffbeac43719d655","repo":"JuliusBrussee/caveman","slug":"file-too-large-to-compress-safely-max-500kb-fi","errorCode":null,"errorMessage":"File too large to compress safely (max 500KB): {filepath}","messagePattern":"File too large to compress safely \\(max 500KB\\): (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"plugins/caveman/skills/caveman-compress/scripts/compress.py","lineNumber":284,"sourceCode":"\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):\n        print(\"Skipping (not natural language)\")\n        return False","sourceCodeStart":266,"sourceCodeEnd":302,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/plugins/caveman/skills/caveman-compress/scripts/compress.py#L266-L302","documentation":"Error \"File too large to compress safely (max 500KB): {filepath}\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at plugins/caveman/skills/caveman-compress/scripts/compress.py:284 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Compress a file of at most 500KB, or split the content first."],"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"}