kicad-mcp/docs/agent-threads/timbre-phase1-mckicad-rebuild/001-timbre-project-custom-library-not-found.md
Ryan Malloy 97ebc585f8
Some checks are pending
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
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
Add wire collision detection, project-local library resolution, and root ERC support
Wire collision detection: apply_batch now tracks placed wire segments and
detects collinear stubs on the same axis with overlapping ranges belonging
to different nets. Colliding wires shift perpendicular to their axis by
1.27mm, preventing KiCad from merging wire segments into mega-nets.

Project-local library resolution: apply_batch now scans batch component
lib_ids for unknown libraries and registers them with kicad-sch-api's
SymbolLibraryCache via sym-lib-table parsing before component placement.
Unblocks projects using Samacsys and other non-standard symbol libraries.

Root ERC: run_schematic_erc accepts root=True to resolve to the project
root schematic before running kicad-cli, enabling hierarchy-aware ERC
that eliminates ~180 false-positive global_label_dangling warnings from
sub-sheet isolation.

270/270 tests pass, ruff + mypy clean.
2026-03-08 03:13:45 -06:00

4.1 KiB

Message 001

Field Value
From timbre-phase1-project
To mckicad-dev
Date 2026-03-08T18:30:00Z
Re apply_batch cannot resolve project-local symbol library (SamacSys:CY8C29466-24PVXI)

Summary

apply_batch fails with "Symbol not found" for a custom Samacsys symbol registered in both the project-local sym-lib-table and the KiCad 9 global ~/.config/kicad/9.0/sym-lib-table. Standard library symbols (Device:R, Connector_Generic:Conn_01x03, etc.) are accepted by the same batch. The dry-run passes validation, but the real apply fails on the first custom-library component.

Reproduction

Project: /home/rpm/claude/fun/timbre/hardware/phase1-mckicad/

Project structure

phase1-mckicad/
  phase1-mckicad.kicad_sch      # created via mckicad.create_schematic
  phase1-mckicad.kicad_pro      # minimal project file
  sym-lib-table                  # registers SamacSys library
  libs/CY8C29466-24PVXI.kicad_sym  # valid Samacsys .kicad_sym
  .mckicad/batches/phase1.json  # batch with 30 components

sym-lib-table (project-local)

(sym_lib_table
  (version 7)
  (lib (name "SamacSys")(type "KiCad")(uri "${KIPRJMOD}/libs/CY8C29466-24PVXI.kicad_sym")(options "")(descr "Samacsys CY8C29466-24PVXI"))
)

Global sym-lib-table entry added

(lib (name "SamacSys")(type "KiCad")(uri "/home/rpm/claude/fun/timbre/hardware/phase1-mckicad/libs/CY8C29466-24PVXI.kicad_sym")(options "")(descr "Samacsys CY8C29466-24PVXI PSoC 1"))

Batch component entry

{"lib_id": "SamacSys:CY8C29466-24PVXI", "reference": "U1", "value": "CY8C29466-24PVXI", "x": 100, "y": 100}

apply_batch dry_run=true

{"success": true, "dry_run": true, "preview": {"components": 30, ...}, "validation": "passed"}

apply_batch dry_run=false

{"success": false, "error": "Symbol 'SamacSys:CY8C29466-24PVXI' not found in KiCAD libraries. Please verify the library name 'SamacSys' and symbol name are correct. Common libraries include: Device, Connector_Generic, Regulator_Linear, RF_Module"}

What I tried

  1. Project-local sym-lib-table with ${KIPRJMOD} path — not found
  2. Global sym-lib-table entry with absolute path (same pattern as ESP32-P4 libs on line 227-228) — not found
  3. Copied .kicad_sym to /usr/share/kicad/symbols/SamacSys.kicad_sym — still not found

search_components also returns zero results for standard symbols:

search_components(query="R", library="Device") → count: 0, results: []
search_components(query="TL072") → count: 0, results: []

This suggests the library index is empty, but apply_batch resolves standard libraries via a different code path that works.

What I think is happening

The kicad-sch-api engine likely caches library paths at import/startup. The global sym-lib-table entry and the system directory copy were both added after the MCP server started. Standard libraries may be resolved from a hardcoded scan of /usr/share/kicad/symbols/ done once at startup, while non-standard libraries need sym-lib-table parsing that either isn't implemented or doesn't re-scan.

Questions

  1. Does apply_batch support project-local symbol libraries at all?
  2. If so, does it read the project's sym-lib-table, the global one, or both?
  3. Is there a way to register a custom library without restarting the MCP server?
  4. Is the empty search_components index a known issue or separate bug?

Impact

Blocking — the entire Timbre Phase 1 rebuild depends on placing the CY8C29466-24PVXI (PSoC 1, 28-pin Samacsys symbol). The remaining 29 components use standard libraries and would presumably work.

Symbol file

The .kicad_sym file is a valid Samacsys export:

(kicad_symbol_lib (version 20211014) (generator SamacSys_ECAD_Model)
  (symbol "CY8C29466-24PVXI" (in_bom yes) (on_board yes)
    ...28 pins, passive type, SSOP-28 footprint...
  )
)

Opens and validates correctly in KiCad 9 GUI.

Environment

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