tscircuit DRC: pcb_pad_trace_clearance_error

Diagnostic signature

pcb_pad_trace_clearance_error

Emitted during design rule checks when an unrelated PCB copper trace is placed closer to a component pad than the permitted minimum clearance distance on the same layer.

What it means

The 'pcb_pad_trace_clearance_error' diagnostic is a design rule check (DRC) failure element defined within the Circuit JSON ecosystem. It signifies that the physical spacing between the boundary of a component pad (such as a surface-mount pad or through-hole pad) and the centerline/edge of an electrically isolated PCB trace falls below the required manufacturing or electrical clearance threshold on the specified copper layer. The error element carries references to the affected pad ID ('pcb_pad_id') and trace ID ('pcb_trace_id'), along with computed actual spacing and required minimum distance values.

Why it happens

Design rule verification algorithms (such as checkPadTraceClearance in @tscircuit/checks) iterate over board layout elements to calculate minimum geometric distances between copper features on identical layers. When a trace belongs to a different electrical net than an adjacent pad, the spacing between the pad contour and the outer boundary of the trace conductor must satisfy the configured clearance constraint. If routing geometry places the trace too close to the pad boundary, or if manual/autorouted layout coordinates overlap without an electrical connection, the checker appends a 'pcb_pad_trace_clearance_error' object to the Circuit JSON output.

Minimal reproduction

import { checkPadTraceClearance } from "@tscircuit/checks"
import type { AnyCircuitElement } from "circuit-json"

const circuitJson: AnyCircuitElement[] = [
  {
    type: "pcb_smtpad",
    pcb_smtpad_id: "pad_1",
    shape: "rect",
    x: 0,
    y: 0,
    width: 1.0,
    height: 1.0,
    layer: "top"
  },
  {
    type: "pcb_trace",
    pcb_trace_id: "trace_1",
    route: [
      {
        route_type: "wire",
        x: 0.6,
        y: -2.0,
        width: 0.15,
        layer: "top"
      },
      {
        route_type: "wire",
        x: 0.6,
        y: 2.0,
        width: 0.15,
        layer: "top"
      }
    ]
  }
]

const errors = checkPadTraceClearance(circuitJson as any, {
  minClearance: 0.15
})

console.log(JSON.stringify(errors, null, 2))

How to fix it

Increase the separation between the trace and the pad to meet or exceed the minimum clearance specification, either by shifting trace route coordinates, rerouting around the component, or moving the component.

```typescript
import { checkPadTraceClearance } from "@tscircuit/checks"
import type { AnyCircuitElement } from "circuit-json"

const circuitJson: AnyCircuitElement[] = [
  {
    type: "pcb_smtpad",
    pcb_smtpad_id: "pad_1",
    shape: "rect",
    x: 0,
    y: 0,
    width: 1.0,
    height: 1.0,
    layer: "top"
  },
  {
    type: "pcb_trace",
    pcb_trace_id: "trace_1",
    route: [
      {
        route_type: "wire",
        x: 1.5,
        y: -2.0,
        width: 0.15,
        layer: "top"
      },
      {
        route_type: "wire",
        x: 1.5,
        y: 2.0,
        width: 0.15,
        layer: "top"
      }
    ]
  }
]

const errors = checkPadTraceClearance(circuitJson as any, {
  minClearance: 0.15
})

console.log(JSON.stringify(errors, null, 2))
```

Step 1

Step 2

Step 3

Step 4

Step 5

Upstream references

circuit-json [email protected] — PcbPadTraceClearanceError — retrieved 2026-08-11

tscircuit/circuit-json: PcbPadTraceClearanceError Interface Declaration