{"record":{"id":"cd8c4ecab8594864","repo":"JuliusBrussee/caveman","slug":"cave-input-too-large","errorCode":"cave_input_too_large","errorMessage":"cave_input_too_large: stdin exceeds %d bytes","messagePattern":"cave_input_too_large: stdin exceeds (.+?) bytes","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"engine/cmd/caveman-engine/main.go","lineNumber":239,"sourceCode":"\t\tout, err = toonDecodeBytes(input)\n\tdefault:\n\t\tfatal(\"usage: caveman-engine toon encode|decode\")\n\t}\n\tif err != nil {\n\t\tfatal(\"toon %s: %v\", args[0], err)\n\t}\n\tif _, err := os.Stdout.Write(out); err != nil {\n\t\tfatal(\"write stdout: %v\", err)\n\t}\n}\n\nfunc readBoundedInput(r io.Reader, maxBytes int64) ([]byte, error) {\n\tinput, err := io.ReadAll(io.LimitReader(r, maxBytes+1))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tif int64(len(input)) > maxBytes {\n\t\treturn nil, fmt.Errorf(\"cave_input_too_large: stdin exceeds %d bytes\", maxBytes)\n\t}\n\treturn input, nil\n}\n\nfunc runPixel(args []string) {\n\tif len(args) < 1 {\n\t\tpixelUsage()\n\t\tos.Exit(2)\n\t}\n\tswitch args[0] {\n\tcase \"render\":\n\t\trunPixelRender(args[1:])\n\tcase \"simulate\":\n\t\trunPixelSimulate(args[1:])\n\tcase \"help\", \"--help\", \"-h\":\n\t\tpixelUsage()\n\tdefault:\n\t\tfatal(\"usage: caveman-engine pixel render|simulate\")","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/engine/cmd/caveman-engine/main.go#L221-L257","documentation":"The CLI's bounded-input guard rejected stdin because it exceeded maxStdinBytes. Input is read through io.LimitReader(r, max+1); getting more than max bytes proves the limit was hit, so the run aborts before doing work. The error carries the code cave_input_too_large for machine handling.","triggerScenarios":"Piping or redirecting a file larger than maxStdinBytes into any caveman-engine subcommand that reads stdin (compress, detect, etc.).","commonSituations":"Feeding a huge log, dataset, or concatenated corpus where the default cap is smaller; raising expectations after a version bump that lowered the cap; CI fixtures that grew past the limit.","solutions":["Split the input into chunks at or under maxStdinBytes and process them separately.","If your integration allows it, raise maxStdinBytes at CLI configuration/flag level and re-run.","Pre-check the payload size in your wrapper script before invoking the engine.","Compress or filter the input upstream if only a subset is relevant."],"exampleFix":"# before\nbig.log | caveman-engine compress\n\n# after: pre-check and split\nsplit -b $((MAX-1)) big.log chunk. && for f in chunk.*; do caveman-engine compress < \"$f\"; done","handlingStrategy":"validation","validationCode":"func sizeWithinLimit(path string, max int64) bool {\n    fi, err := os.Stat(path)\n    return err == nil && fi.Size() <= max\n}","typeGuard":null,"tryCatchPattern":"// Parse the exit output for the cave_input_too_large code and split the input\n// rather than retrying the same oversized payload.","preventionTips":["Check file size (stat) before piping into the engine.","Split large inputs with split(1) at a size under the cap.","Keep track of the engine's maxStdinBytes when upgrading versions."],"tags":["cli","input-limit","stdin","validation"],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}