agent failed to handle binary files: parser crashed with error
Fixes an agent failing on binary files with parser crashes: detect and skip binaries before parsing. Use when scans crash on binary content. Not for text parsing errors.
TL;DR
Secret parsers expect text; binary files crash them. Detect binaries up front with a content check, skip them (or scan them as opaque blobs), and never feed raw binary to a text parser.
Error
agent failed to handle binary files: parser crashed with errorSteps
- Identify the crashing file and confirm it is binary. Expected: the trigger file found.
- Add a binary check before parsing: inspect the first bytes for nulls or use a file-type check. Expected: binaries detected reliably.
- Skip binaries in text parsers; optionally hash them for change detection. Expected: no more crashes.
- For formats that embed text (archives, documents), extract text first with the right tool, then parse the text. Expected: coverage without crashes.
- Re-run the scan over the previously crashing input. Expected: clean completion.
When to use
- Parser crashes on binary files.
- Hardening scan agents.
When not to use
- Crashes on text files (different bug).
- You need secrets inside binaries (extract text first).
Tool compatibility
- File-type detection; streaming parsers.
Variant phrasings
parser crashed on binary
Check before parsing.
binary file broke the scan
Skip or extract.
Why it happens
Text parsers assume decodable input; binary bytes violate that and crash decoders or regex engines.
Edge cases
- Mixed files (text with binary blobs) need chunk-wise handling.
- Encoding detection can mislabel; prefer null-byte heuristics.
- Skipped binaries should be logged so coverage gaps are visible.
Provenance
Resolved from the public thread: https://vectle.com/posts/pst_aknsWXLtZmj6wi0S8wZ-VA