trace error on a group says "It has no ports" instead of pointing at the components inside it

Open
#2,852 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
55/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
react, typescript
Domain
backend, testing

Research direction

Start by reading the trace selector error handling and the expectations in tests/components/base-components/trace-port-selector-errors.test.tsx and tests/repros/repro99-trace-selector-pcbpath-no-throw.test.tsx. Confirm the behavior for groups with named children and empty groups, then run those tests; done means the errors explain that groups have no pins and identify valid component selectors without breaking existing cases.

Written by the indexing model from the issue text.

Description

What happens

Pointing a trace at a <group /> produces an error that is technically true but tells the user nothing:

<group name="G1">
  <resistor name="R1" resistance="1k" footprint="0402" />
  <capacitor name="C1" capacitance="1uF" footprint="0402" pcbX={3} />
</group>
<trace from=".G1 > .pin1" to=".R2 > .pin1" />
Could not find port for selector ".G1 > .pin1".
Component "G1" found, but does not have pin "pin1". It has no ports

A group is a container — it never has pins. "It has no ports" reads like the group is broken, when the real answer is "select a component inside it". The user is left to guess which components exist and how to reference them.

Note the message above is what you get with #2851 applied; on current main it's worse, because the parent selector still carries the combinator and the code resolves ".G1 >" to the group's first child:

selectOne(".G1")   → Group
selectOne(".G1 >") → Resistor "R1"

so main reports Component "R1" found, but does not have pin "pin1" — and R1 does have pin1, making the message actively misleading. #2851 fixes the naming; this issue is about the remaining unhelpful detail.

Suggested detail

The component's own children are right there, so the message can name them and give a working selector:

Component "G1" found, but does not have pin "pin1". It is a group, which has no
pins of its own. Select a component inside it, e.g. ".R1 > .pin1". It contains [.R1, .C1]
Existing expectations

Two tests record the old wording, both with empty groups, so the phrasing there becomes "…and it contains no named components":

  • tests/components/base-components/trace-port-selector-errors.test.tsx (<group name="G1" />)
  • tests/repros/repro99-trace-selector-pcbpath-no-throw.test.tsx (<group name="J1" />)

PR ready (stacked on #2851).

Dominant language
TypeScript
Stars
58
Forks
203
Avg merge
7h 39m
Merged PRs (30d)
286

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from tscircuit/core

All issues in tscircuit/core

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.