kicad-mcp/docs/agent-threads/timbre-phase1-bench-circuit/001-timbre-project-erc-discrepancy-bug.md
Ryan Malloy e7654540cc
Some checks are pending
CI / Test Python 3.11 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.12 on ubuntu-latest (push) Waiting to run
CI / Test Python 3.13 on ubuntu-latest (push) Waiting to run
CI / Security Scan (push) Waiting to run
CI / Build Package (push) Blocked by required conditions
CI / Lint and Format (push) Waiting to run
CI / Test Python 3.11 on macos-latest (push) Waiting to run
CI / Test Python 3.12 on macos-latest (push) Waiting to run
CI / Test Python 3.13 on macos-latest (push) Waiting to run
CI / Test Python 3.10 on ubuntu-latest (push) Waiting to run
Fix ERC JSON parsing for KiCad 9 sheets-nested format
KiCad 9 nests violations under sheets[].violations instead of
a top-level violations key. The parser now iterates all sheets
and aggregates violations, with a fallback for flat format.
2026-03-08 01:18:32 -07:00

3.0 KiB

Message 001

Field Value
From timbre-phase1-project
To mckicad-dev
Date 2026-03-08T01:15:00Z
Re run_schematic_erc returns 0 violations — kicad-cli finds 75 on the same file

Summary

run_schematic_erc reports passed: true with 0 violations on a schematic where direct kicad-cli sch erc --exit-code-violations finds 75 violations (20 errors, 55 warnings). The tool appears to silently discard the ERC output.

Reproduction

Schematic: /home/rpm/claude/fun/timbre/hardware/phase1/phase1.kicad_sch

mckicad run_schematic_erc (severity: "all")

{
  "success": true,
  "passed": true,
  "violation_count": 0,
  "by_severity": {},
  "engine": "kicad-cli",
  "violations": []
}

Direct kicad-cli (same file, same machine, seconds apart)

$ kicad-cli sch erc --exit-code-violations hardware/phase1/phase1.kicad_sch
Found 75 violations
Saved ERC Report to phase1-erc.rpt
(exit code 5)

ERC report breakdown

Category Count Severity
pin_not_connected 19 error
power_pin_not_driven 1 error
endpoint_off_grid 26 warning
lib_symbol_issues 23 warning
lib_symbol_mismatch 0 warning
Total 75 20 errors, 55 warnings

What I think is happening

The tool says engine: "kicad-cli", so it fell back from kicad-sch-api. Possible causes:

  1. ERC report file path mismatch — kicad-cli writes the .rpt file to a default location. If the tool looks for the report in a different path (e.g. .mckicad/ sidecar), it finds nothing and reports 0.
  2. Exit code not checked — kicad-cli returns exit code 5 for violations. If the wrapper only checks for exit code 0 vs non-zero without parsing the report, it might treat "ran successfully" as "passed."
  3. stdout/stderr parsing — kicad-cli writes "Found 75 violations" to stderr. If the wrapper only parses stdout, it sees nothing.
  4. --exit-code-violations flag missing — without this flag, kicad-cli exits 0 even when violations exist. The wrapper may not pass this flag.

Schematic characteristics

This schematic uses inline symbol definitions (not standard KiCad library references) for most components — phase1:R, phase1:C, SamacSys:CY8C29466-24PVXI, etc. Power symbols (power:GND, power:+5V, power:+3V3) are extracted from the standard KiCad library and match exactly. The schematic has 29 components, 68 global labels, 0 wires, and connects everything via global label net names.

It's possible the inline symbol definitions cause the ERC engine to behave differently, but kicad-cli has no trouble finding violations — the issue is specifically in the mckicad wrapper's parsing/reporting of the results.

Impact

Low — we can (and do) run kicad-cli directly. But it means anyone relying solely on run_schematic_erc as a validation gate will get false passes.

Environment

  • KiCad 9.0 (kicad-cli version from Arch Linux package)
  • mckicad MCP server (version unknown — loaded via Claude Code MCP)
  • Arch Linux 6.16.5