KiCad 9.0.2 Fails to Load Valid .kicad_sym: “need a number for 'pin orientation'”

I’m on KiCad 9.0.2 (Windows), and trying to create a symbol library file in Python in the .kicad_sym format. No matter what I do, I get this error:

need a number for 'pin orientation' in 'C:\path\to\symbol.kicad_sym', line X, offset Y
Not all symbol libraries could be loaded.

This happens with even the most minimal possible valid file. Here’s the full contents of a test file that still fails:

(kicad_symbol_lib (version 20211014) (generator "manual")
  (symbol "TestMinimal"
    (property "Reference" "U" (at 0 0 0) (effects (font (size 1 1))))
    (property "Value" "TestMinimal" (at 0 -2.54 0) (effects (font (size 1 1))))
    (pin input line (at 0 0) (length 2.54)
      (name "IN" (effects (font (size 1 1))))
      (number "1" (effects (font (size 1 1))))
      (unit 1)
      (orientation 0)
    )
  )
)

Yes:

  • The file uses LF line endings
  • It is correctly named .kicad_sym
  • It is correctly registered in the Symbol Libraries manager
  • There are no other .lib entries or legacy formats involved

I’ve tried:

  • Deleting cache/config from AppData\Roaming\kicad
  • Re-adding the symbol library from scratch
  • Creating a new blank project
  • Testing minimal symbols with 1 pin and numeric orientation
  • Validating against KiCad documentation

Still no luck.

Is this a known bug with 9.0.2 on Windows? Or is there some weird configuration I’ve missed?
Happy to provide more info, or upload the failing files if needed.

Not exactly a symbol format expert, but are you sure this is a valid symbol? What makes you sure?

Specifically, the (unit …) and (orientation …) atoms don’t look right to me based on the file format documentation and I don’t see those in any symbols in KiCad’s libraries. Try deleting those.

Update to V9.0.3 first. Updates in the third digit are bug fix updates, and keeping up to date is easier then trying to manage whether the bug or troubles you are finding have been fixed or not.