Skip to content

Windows: board-identity errors print KiCad's open boards as \\?\ verbatim paths beside a raw requested path #673

Description

@pauliuszaleckas

Summary

On Windows, the board-identity errors print KiCad's open boards as
extended-length ("verbatim") paths while printing the requested board as the
caller typed it, so one message shows the same directory in two spellings:

requested board 'C:\Users\me\proj\board.kicad_pcb' is not open in KiCad
  (open boards: \\?\C:\Users\me\proj\other.kicad_pcb)

Board identity is unaffected — the comparison is correct and this is a
display problem only. But these errors exist so a caller can see which board
KiCad actually holds and retry against it, and a \\?\ path is a poor thing to
hand back for that purpose.

Reported by

@mixelpixx, reviewing #656 on KiCad 10.0.5 / Windows 11, against a release
build driving a standalone pcbnew over stdio. Quoting the review:

On Windows the wrong_document message prints the open board with a \\?\
prefix. Cosmetic, probably older than this PR; worth a follow-up issue, not a
change here.

Filing it as asked. Not reproduced by me — I am on Fedora Linux, where
canonicalize returns a plain absolute path and the defect cannot appear. What
follows is a code trace, not a second measurement, and a Windows user
confirming the exact rendering would be welcome.

Mechanism

In select_requested_board (crates/konnect-ipc/src/client.rs) the two halves
of the message come from different forms of the path:

  • requested is the raw argument — requested.display().to_string() (:4202).
  • open_documents is built from the identities (:4273), which are
    comparable_identity() output (:4335) — i.e. path.canonicalize().

std::fs::canonicalize on Windows returns a verbatim path (\\?\C:\…); on
Unix it returns a plain absolute path. Hence the asymmetry, and hence
Windows-only.

Scope

board_document_label (:4186) is the shared source, so this is wider than
wrong_document. Every error kind built from an open-document identity shows
verbatim paths on Windows:

Error kind Field
wrong_document open_documents
ambiguous_target candidates
stale_target previously_bound, and the open-document list in reason
ambiguous_open_board the "reports '…' open more than once" reason (:4265)

requested is raw in all of them, so every one of these can show two spellings
of one directory side by side.

Age

comparable_identity landed in f8139e8 (2026-08-31, "tell a KiCad without this
board open apart from a refusal"). There is no verbatim-prefix handling
anywhere in the workspace today. So this predates #656, which touches
client.rs only in the enabled-layer methods and none of the identity or label
code.

Expected

Render these paths in the form a user typed and can paste back, while leaving
the comparison on the canonical form.

Two constraints for whoever picks this up:

  1. Display only. Canonicalized paths must keep flowing into
    select_requested_board's matching. Normalising before the comparison would
    reintroduce exactly the identity defect fix(pcb): tell a KiCad without this board open apart from a refusal #407 fixed.
  2. \\?\UNC\ is not a prefix you can strip. \\?\UNC\server\share\x has
    to render as \\server\share\x, not UNC\server\share\x. A naive
    strip_prefix(r"\\?\") silently corrupts every network path.

Worth a test matrix covering a drive path, a UNC path, a path that does not
exist (which takes comparable_identity's lexical branch and so has no prefix
to begin with), and a Unix path that must pass through untouched.

Related

#537 also concerns how Konnect reports paths, but is a different defect —
which path gets resolved and whether the error names it. This one is about
how an already-resolved absolute path is rendered.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Wanted, not urgentarea:platformInstall, discovery, OS and KiCad-version compatibilitybugSomething isn't workingstatus:ready-for-workNext actor: any contributor — scoped and unclaimed

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions