Skip to content
Documentation

Diagnostics

Every toolchain failure is a source-located Luca error rendered as Error at line:column: message (luca_code::error::LucaError). The catalog freezes those message shapes: tests/diagnostics.rs asserts each reachable message byte-for-byte, so any wording change is a breaking change requiring a version note.

The visual pipeline additionally emits non-fatal render warnings for recognized-but-invalid layout/style entries (see Render warnings); they never replace a structural error and never prevent rendering.

Conventions: line:column is 1-based. Unless noted, the location is the offending declaration (prop key start, entry start, block start, or root).

Parse and structure (parser)

#MessageLocationExample
P1Expected a component, found empty file1:1empty input
P2Root component must start at column 1offending indent␣␣App:
P3Property outside a componentprop/line startid = "x" alone
P4Expected a component name before ':': line:
P5Invalid component name '123'name start123:
P6Expected 'Name:' or 'key = value', found 'App'line startApp
P7Expected a single root component per .lucu filesecond roottwo App: blocks
P8Tabs are not allowed for indentation; use spacesoffending line, col 1tab indent
P9Unterminated multiline comment[[ start[[ oops
P10Unterminated string literalvalue starttext = "oops
P11Invalid property name 'my-prop'key startmy-prop = 1
P12Expected a value after '='after =text =
P13Unknown escape '\q' in stringvalue starttext = "a\qb"
P14Invalid value '1.2.3'value starttext = 1.2.3
P15Imperative component operations are not supported; update state and allow the UI to reactcall line/value startshow(), text = hide()
P16Imperative component operation 'hide' is not supported; update state and allow the UI to reactkey starthide = true
P17`{block}` must belong to a componentroot blocklayout: at column 1
P18Unexpected text after string literal: '{rest}'value starttext = "a" "b"

Defensive (in code, unreachable through parse; not asserted): Component outside a parent component, both Inconsistent indentation branches.

Component validation (component, library)

#MessageLocation
C1Duplicate property 'id' on component 'App' (first at 2:3)second key
C2Duplicate id 'a' (first at 2:3); ids must be unique for testssecond id
C3Property 'id' must be a non-empty stringid key
C4Property 'visible' must be bool, found strkey (str/number/none/ref as found)
C5Property 'label' must be str, found numberkey
C6Unknown property 'count' on component 'App' (supports: disabled, id, label, visible)key; registered components only, keys sorted

Literal Ref values on locked keys (C3–C5 shapes) parse and enforce at resolution instead (see R4–R6).

Blocks (component extraction, layout shared checks)

#MessageLocation
B1Duplicate 'layout' block on component 'App'second block
B2Only `key = value` entries are allowed inside `layout` (found component 'Text')nested component
B3Duplicate 'gap' in `layout` block of component 'App' (first at 3:5)second entry

B1–B3 apply to every block kind with its own name (layout, style, state, events, transitions, theme).

State (state)

#MessageLocation
S1State initial values must be literals (found reference 'b')entry
S2Duplicate state 'a' (first at 3:5)second declaration
S3State 'x' must be a scalar value in 0.4declaration/update site
S4Expected int, found str for state 'visits'declaration site
S5'missing' is not declared1:1 (programmatic update)
S6Invalid number '999…' for state 'n'entry (overflow/scale)

Bindings (bindings)

#MessageLocation
R1'nowhere' is not declaredbinding site
R2Invalid number '999…' (no for suffix)literal site
R3Duplicate id 'a' (first at 5:3); ids must be unique for testssecond resolved id
R4Property 'id' must be a non-empty stringbinding site
R5Property 'visible' must be bool, found strbinding site
R6Property 'label' must be str, found intbinding site

Defensive: the Invalid value fallback and the imperative-key arm (parse rejects both shapes first).

Events, navigation, runtime (events, navigation, runtime)

#MessageLocation
E1No component with id 'missing'tree root
E2Component 'greeting' declares no eventscomponent
E3Component 'visit' declares no event 'swipe'events: block
E4Event 'tap' handler must be a Luca Code handler name, found strentry
N1Cannot navigate back from the root screentree root
L1Cannot scope work to unmounted component 'x'tree root

Navigator reuses E1's shape for unknown targets.

Themes (themes)

#MessageLocation
T1Theme 'name' must be a stringentry
T2Unknown theme mode 'sepia'; expected system, light, or darkentry
T3Unknown theme mode; expected system, light, or darkentry (non-scalar)

Seam (seam)

#MessageLocation
F1Luca UI source files must use the .lucu extension1:1
F2Could not read {path}: {os error}1:1
F3Luca Code source files must use the .lucc extension1:1
F4No paired Luca Code source found at {path}1:1
F5Event '{event}' on component '{id-or-name}' names handler '{handler}', which is not defined in the paired Luca Code sourceevent entry

F5 is raised by luca-ui check only when the paired source has no imports, so the handler can be verified locally. With imports, the same situation is reported as an unverified note instead of an error.

Render warnings (layout, style, visual pipeline)

These are not LucaErrors. They appear as Render warning at line:column: message and never fail a render.

#MessageTrigger
W1Unknown layout direction "{text}"; expected "column" or "row"direction string outside the subset
W2Layout entry 'direction' must be str, found {kind}non-string direction
W3Unknown layout align "{text}"; expected "start", "center", "end", or "stretch"align string outside the subset
W4Layout entry 'align' must be str, found {kind}non-string align
W5Layout entry '{key}' must be a non-negative integer, found {kind}gap/padding/width/height
W6Style entry '{key}' must be a #rrggbb color, found "{text}"background/color/border
W7Style entry '{key}' must be str, found {kind}non-string color token
W8Style entry '{key}' must be a non-negative integer, found {kind}radius/font_size

Unknown entry names produce no warning: they stay opaque by design.

Testing harness (testing)

Reuses E1's shape (No component with id '…') at the resolved root for prop/text/visible/label/bounds lookups.