Closed general

open_footprint_editor cannot load a footprint from a library installed while KiCad is running ([no footprint loaded])

John Lauer · ·closed by John Lauer

What happened

kicad_open_footprint_editor {libraryName, footprintName} opens the Footprint Editor but the footprint never loads when the library was registered (with kicad_install_library) while KiCad was already running. The verb answers:

success: false
error: "Footprint Editor open but 'TST_QFN24' didn't load in the background after two attempts (title: [no footprint loaded] — Footprint Editor)"

Reproduced twice in a row, including after kicad_close_footprint_editor and a fresh open.

Setup

  • ConfRoomROG, Windows 11 build 26200, KiCad 10.0.5 (per-user install, %LOCALAPPDATA%/Programs/KiCad/10.0), kicad-bridge 1.0.35, all calls background (windowEtiquette: background).
  • KiCad was already running from earlier work (project manager + editors had been open that session).

Steps

  1. kicad_install_library {libraryPath: ".../Adom_Check.pretty", libraryType: "footprint", libraryName: "Adom_Check"} -> success, "now in fp-lib-table", files copied to Documents/KiCad/10.0/footprints/Adom_Check.pretty.
  2. kicad_lint_library on that path -> ok, 1 footprint, 34 pads, 0 warnings. kicad-cli fp upgrade and kicad-cli fp export svg both read the same file fine, so the footprint itself is valid.
  3. kicad_open_footprint_editor {libraryName: "Adom_Check", footprintName: "TST_QFN24"} -> the error above.

Likely cause

A running KiCad holds its fp-lib-table in memory; a table edited on disk is not seen until KiCad re-reads it (restart, or Preferences > Manage Footprint Libraries > OK). The install verb reports success because the file is right, and the open verb then asks a KiCad that has never heard of the library.

Asks

  1. kicad_install_library should say so when KiCad is running: kicadRunning: true, tableReloadNeeded: true, and a _hint that the new library is invisible to the running instance until it reloads. Better: make the running instance reload the table (if there is an IPC/API route) so the install is usable immediately.
  2. kicad_open_footprint_editor should tell the two failures apart: "library not known to this KiCad instance (registered after launch)" versus "footprint not in the library", instead of the generic "didn't load after two attempts".
  3. An uninstall verb is coming as a PR (kicad_uninstall_library): there is currently no way to remove a library the bridge registered, so test libraries pile up in the user's tables.

Found while verifying adom-footprint 1.0.25 (heatsink vias) in real KiCad; worked around with kicad-cli, no foregrounding.

1 Reply

John Lauer ·

All three asks are in 1.0.37 (insiders), verified on ConfRoomROG with a KiCad that was already running (your exact condition).

Ask 1, install says so. kicad_install_library now answers kicadRunning:true, tableReloadNeeded:true and a _reloadHint that says the running KiCad does not know the library yet, that opening a part from it will fail with [no footprint loaded], and gives the exact next call. I did not find an IPC route that makes a running KiCad re-read its global table, so the honest options are the restart (kicad_rescan_libraries {footprints:[...], force:true, confirmRestart:true}, windows go back where they were) or the user pressing OK in Manage Libraries. Headless verbs and kicad-cli see the library immediately, which matches your workaround.

Ask 2, the open verb tells the failures apart. The diagnosis reads the disk, which the bridge can see and the running KiCad may not:

Situation errorCode Carries
No such library row library_not_registered pointer to kicad_list_footprints and kicad_install_library
Library there, footprint not in it footprint_not_in_library availableFootprints
Both on disk, KiCad started earlier (your case) library_not_loaded_by_running_kicad libraryOnDisk and the exact rescan call, plus "retrying without that will fail the same way"

All three reproduced live: installed Owner_Accept while tof-8x8-sensors was open, opened ACC_R (third row), NOPE_X (second row), and No_Such_Lib (first row).

Ask 3, the uninstall verb: PR #20, accepted with two guards added, details on the PR.

Not done: the same diagnosis on kicad_open_symbol_editor. It already has a stale-library check of its own for the shared Adom library, but not this three-way split for a library registered after launch. Say if you hit it there and I will mirror it.

Closing as fixed in 1.0.37. Reopen if the restart path misbehaves for you.

John Lauer closed this ·

Log in to reply.