tscircuit schematic_layout_error

Diagnostic signature

schematic_layout_error

Emitted by tscircuit when the schematic layout engine fails to compute valid coordinates, bounding geometry, or symbol arrangements for a schematic group or subcircuit.

What it means

The schematic_layout_error diagnostic is an error element in Circuit JSON indicating that the compiler or schematic layout solver failed to position and size the contents of a schematic group (identified by schematic_group_id and source_group_id). In tscircuit, groups and subcircuits undergo layout calculation to determine their schematic bounding box, component placement, and interconnect paths. When the layout engine encounters unsolvable positioning constraints or an internal failure during group arrangement, it writes a schematic_layout_error element into the output Circuit JSON.

Why it happens

This error occurs during schematic compilation when: 1) The automatic schematic layout algorithm cannot solve component placement for the hierarchy within a <group> or <subcircuit>; 2) Conflicting schematic coordinate props (such as contradictory schX, schY, or relative anchor offsets) prevent the engine from computing valid width, height, and center coordinates for the schematic_group; 3) Unresolvable pin arrangements or port alignments within a nested subcircuit exceed the layout solver's placement rules.

Minimal reproduction

import { schematic_layout_error } from "circuit-json"

// Demonstrating parsing and validation of a schematic layout error element
const layoutErrorElement = schematic_layout_error.parse({
  type: "schematic_layout_error",
  error_type: "schematic_layout_error",
  message: "Failed to compute schematic layout for group subcircuit_power_stage",
  source_group_id: "source_group_power_stage",
  schematic_group_id: "schematic_group_power_stage",
  subcircuit_id: "subcircuit_power_stage"
})

console.log(layoutErrorElement)

How to fix it

Resolve layout conflicts within the problematic group by removing conflicting positioning constraints, providing explicit schematic coordinates, or disengaging failing autolayout routines.

```typescript
import React from "react"

// Explicitly positioned components inside a group prevent layout calculation failures
export const PowerStage = () => (
  <group name="power_stage">
    <resistor
      name="R1"
      resistance="10k"
      footprint="0805"
      schX={-2}
      schY={0}
    />
    <capacitor
      name="C1"
      capacitance="100nF"
      footprint="0603"
      schX={2}
      schY={0}
    />
  </group>
)
```

Step 1

Step 2

Step 3

Step 4

Upstream references

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

tscircuit/circuit-json: schematic_layout_error.ts

Automatic Schematic Layout - tscircuit docs