[Bug]: analytical-method-validation exits 1 (findings raised) with a traceback on a ragged CSV row
What happened
parse_rows() in scripts/_common.py builds each CSV row with a comprehension that calls .strip() on every key and value. When a row has more fields than the header, csv.DictReader parks the surplus under the None restkey as a list, so .strip() is called on a list and raises AttributeError.
run_cli() only catches InputError, so the exception escapes and the script dies with a raw traceback. The exit code makes it worse: check_accuracy_precision.py documents
Exit codes: 0 no findings, 1 findings raised, 2 bad input.so a malformed file exits 1 — the code that means analysis completed, problems found — instead of 2. A CI step doing if rc == 1: report findings reads a crash as a clean completed analysis.
What you expected instead
A clean error: on stderr and exit 2, the same as any other bad input.
Steps to reproduce
Pipe a CSV whose third data row has one extra unlabelled field into any of the six scripts that call
parse_rows:printf 'level,measured\n1,1.01\n1,0.99\n1,1.00,EXTRA\n2,2.02\n2,1.98\n2,2.00\n' \ | python skills/analytical-method-validation/scripts/check_accuracy_precision.py -i -See the traceback below, and
$? == 1.Control: removing the extra field gives
error: row 3: column 'measured' is not numeric: ''and exit 2 — a row with fewer fields was already handled correctly. Only a surplus field produces theNonekey, which is what made the asymmetry easy to miss.
Affects every consumer of parse_rows: check_accuracy_precision.py, check_response.py, check_detection_limits.py, compare_methods.py, check_bioanalytical_run.py, plan_validation.py.
Error output
File ".../skills/analytical-method-validation/scripts/check_accuracy_precision.py", line 95, in main
rows = parse_rows(read_input(args.input), args.input)
File ".../skills/analytical-method-validation/scripts/_common.py", line 846, in parse_rows
rows.append({(k or "").strip(): (v or "").strip() for k, v in row.items()})
^^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'strip'exit status: 1
Environment
- Agent host: n/a (ran the script directly)
- Model: n/a
- Repository version or commit:
49c6e97(main) - Python version: 3.12.10
- Operating system: Windows 10
The sibling skill scientific-writing already has the correct guard at its own scripts/_common.py:118 (if None in row: raise InputError("CSV row has more fields than the header")), so this looks like a straightforward port. A fix is proposed alongside that adds the row number and keeps the short-row path unchanged.
Source: K-Dense-AI/scientific-agent-skills