# ArchLang error codes Every diagnostic carries a stable code. Look one up with `arch explain ` (e.g. `arch explain E_ROOM_SIZE`). Errors abort rendering; warnings do not. **34 errors** · **24 warnings** | Code | Severity | Summary | | --- | --- | --- | | [`E_ARGCOUNT`](#e_argcount) | error | Component called with the wrong number of arguments. | | [`E_ARITY`](#e_arity) | error | Built-in function called with the wrong number of arguments. | | [`E_ASSIGN_UNDEF`](#e_assign_undef) | error | Assignment to an undeclared name. | | [`E_CALL_DEPTH`](#e_call_depth) | error | Value-function call stack too deep. | | [`E_COLUMN_SIZE`](#e_column_size) | error | Column must have a positive size. | | [`E_DIV_ZERO`](#e_div_zero) | error | Division or modulo by zero. | | [`E_DOMAIN`](#e_domain) | error | Math domain error. | | [`E_DOOR_WIDTH`](#e_door_width) | error | Door must have a positive width. | | [`E_DUP_ID`](#e_dup_id) | error | Duplicate element id. | | [`E_FURN_AGAINST`](#e_furn_against) | error | Invalid `against wall` fixture placement. | | [`E_FURN_ROOM`](#e_furn_room) | error | Furniture placed `in` an unknown room. | | [`E_FURN_ROTATE`](#e_furn_rotate) | error | Furniture rotation must be a quarter-turn. | | [`E_FURN_SIZE`](#e_furn_size) | error | Furniture must have a positive size. | | [`E_IMPORT_BAD_SPEC`](#e_import_bad_spec) | error | Malformed import spec. | | [`E_IMPORT_CONFLICT`](#e_import_conflict) | error | Imported name conflicts with an existing component. | | [`E_IMPORT_CYCLE`](#e_import_cycle) | error | Cyclic import. | | [`E_IMPORT_NOT_EXPORTED`](#e_import_not_exported) | error | Imported name is not exported by the module. | | [`E_IMPORT_NOT_FOUND`](#e_import_not_found) | error | Import path could not be resolved. | | [`E_IMPORT_PARSE`](#e_import_parse) | error | Imported module has a parse error. | | [`E_INDEX`](#e_index) | error | Array index out of range. | | [`E_LAYOUT_CYCLE`](#e_layout_cycle) | error | Relational room placement forms a cycle. | | [`E_LAYOUT_REF`](#e_layout_ref) | error | Relational placement references an unknown room. | | [`E_OPENING_WIDTH`](#e_opening_width) | error | Opening must have a positive width. | | [`E_RANGE_LIMIT`](#e_range_limit) | error | Range too large. | | [`E_RECURSION`](#e_recursion) | error | Component recursion too deep. | | [`E_REDEF`](#e_redef) | error | Name already defined in this scope. | | [`E_ROOM_SIZE`](#e_room_size) | error | Room must have a positive size. | | [`E_TYPE`](#e_type) | error | Type mismatch. | | [`E_UNKNOWN_COMPONENT`](#e_unknown_component) | error | Unknown component. | | [`E_UNKNOWN_FN`](#e_unknown_fn) | error | Unknown function. | | [`E_UNKNOWN_REF`](#e_unknown_ref) | error | Unknown reference. | | [`E_WALL_THICKNESS`](#e_wall_thickness) | error | Wall must have a positive thickness. | | [`E_WHILE_LIMIT`](#e_while_limit) | error | `while` exceeded its iteration cap. | | [`E_WINDOW_WIDTH`](#e_window_width) | error | Window must have a positive width. | | [`W_BATH_VIA_BEDROOM`](#w_bath_via_bedroom) | warning | Bathroom is reachable only through a bedroom. | | [`W_BEDROOM_NO_WINDOW`](#w_bedroom_no_window) | warning | Bedroom has no window. | | [`W_DOOR_CLEARANCE`](#w_door_clearance) | warning | Door is narrower than the minimum clear width. | | [`W_DOOR_OFF_WALL`](#w_door_off_wall) | warning | Door does not lie on any wall. | | [`W_EMPTY_PLAN`](#w_empty_plan) | warning | Empty plan. | | [`W_FIXTURE_FLOATING`](#w_fixture_floating) | warning | A plumbing/kitchen fixture is not against a wall. | | [`W_FIXTURE_WRONG_ROOM`](#w_fixture_wrong_room) | warning | Fixture sits outside its declared room. | | [`W_FURN_CLEARANCE`](#w_furn_clearance) | warning | A fixture's use-space is blocked. | | [`W_FURNITURE_OVERLAP`](#w_furniture_overlap) | warning | Two pieces of furniture overlap. | | [`W_HATCH_SCALE`](#w_hatch_scale) | warning | Hatch scale must be positive; using 1. | | [`W_NO_ENTRANCE`](#w_no_entrance) | warning | The plan has no exterior door. | | [`W_OPENING_OFF_WALL`](#w_opening_off_wall) | warning | Opening does not lie on any wall. | | [`W_ROOM_DISCONNECTED`](#w_room_disconnected) | warning | Room has no door — it can't be entered. | | [`W_ROOM_NO_FIXTURE`](#w_room_no_fixture) | warning | Bathroom or kitchen has no fixtures. | | [`W_ROOM_NOT_ENCLOSED`](#w_room_not_enclosed) | warning | Bathroom is not fully enclosed. | | [`W_ROOM_OVERLAP`](#w_room_overlap) | warning | Rooms overlap. | | [`W_ROOM_TOO_SMALL`](#w_room_too_small) | warning | Room is implausibly small. | | [`W_ROOM_UNREACHABLE`](#w_room_unreachable) | warning | Room cannot be reached from the entrance. | | [`W_SANITIZED_CONFIG`](#w_sanitized_config) | warning | A disallowed config value was stripped. | | [`W_SWING_OBSTRUCTED`](#w_swing_obstructed) | warning | Door swing is obstructed. | | [`W_UNKNOWN_MATERIAL`](#w_unknown_material) | warning | Unknown wall material; using the default hatch. | | [`W_UNKNOWN_STYLE_KEY`](#w_unknown_style_key) | warning | Unknown style key. | | [`W_UNKNOWN_THEME_KEY`](#w_unknown_theme_key) | warning | Unknown theme key. | | [`W_WINDOW_OFF_WALL`](#w_window_off_wall) | warning | Window does not lie on any wall. | ## E_ARGCOUNT *error* — Component called with the wrong number of arguments. **Cause.** A component instance supplies more or fewer arguments than the component declares parameters. **Fix.** Pass exactly one argument per declared parameter. ```arch component bed(x, y) { … } bed(300) # error: expects 2 arguments ``` ## E_ARITY *error* — Built-in function called with the wrong number of arguments. **Cause.** A built-in (e.g. abs, sqrt, len) was called with the wrong argument count. **Fix.** Check the function's arity; most built-ins take one argument. ```arch let x = abs(1, 2) # error: abs expects 1 argument ``` ## E_ASSIGN_UNDEF *error* — Assignment to an undeclared name. **Cause.** `NAME = value` was used for a name never introduced with `let`. **Fix.** Declare it first with `let`, or fix a typo in the name. ```arch x = 5 # error: declare with `let x = …` first ``` ## E_CALL_DEPTH *error* — Value-function call stack too deep. **Cause.** A value-function recurses (directly or mutually) beyond the call-depth limit. **Fix.** Make the recursion terminate, or rewrite it iteratively with a bounded `while`. ```arch let f(n) = f(n + 1) # error: never terminates ``` ## E_COLUMN_SIZE *error* — Column must have a positive size. **Cause.** A column's width or height evaluated to zero or a negative number. **Fix.** Give the column a positive `size W x H`. ```arch column at (0,0) size 0x300 # error: width is 0 ``` ## E_DIV_ZERO *error* — Division or modulo by zero. **Cause.** An expression divides (or takes a remainder) by a value that evaluates to zero. **Fix.** Guard the divisor, or use a non-zero value. ```arch let x = 10 / 0 # error ``` ## E_DOMAIN *error* — Math domain error. **Cause.** A built-in received an out-of-domain argument (e.g. `sqrt` of a negative number). **Fix.** Pass a value within the function's domain. ```arch let x = sqrt(-1) # error ``` ## E_DOOR_WIDTH *error* — Door must have a positive width. **Cause.** A door's width evaluated to zero or a negative number. **Fix.** Give the door a positive `width`. ```arch door at (0,0) width 0 # error ``` ## E_DUP_ID *error* — Duplicate element id. **Cause.** Two elements declare the same `id=…`; ids must be unique across the plan. **Fix.** Rename one of them, or drop the explicit id to auto-generate a unique one. ```arch room id=a at (0,0) size 1x1 room id=a at (1,0) size 1x1 # error: duplicate id "a" ``` ## E_FURN_AGAINST *error* — Invalid `against wall` fixture placement. **Cause.** A wall-anchored fixture references an unknown wall, omits `segment` on a multi-segment wall, omits `side`, sits on a non-axis-aligned segment, has an out-of-range offset, or also sets `rotate`. The compiler will not guess which wall/side/segment was meant. **Fix.** Name an existing wall id, add `segment ` for multi-segment walls, give `side left|right`, keep the segment axis-aligned, and drop any explicit `rotate`. ```arch furniture wc against wall w1 side left size 400x700 # error if w1 is unknown or multi-segment ``` ## E_FURN_ROOM *error* — Furniture placed `in` an unknown room. **Cause.** A furniture item names a room with `in `, but no room has that id. **Fix.** Use the id of an existing `room id=…`, or drop the `in` clause. ```arch furniture bed at (0,0) size 1500x2000 in bedrm # error: no room id=bedrm ``` ## E_FURN_ROTATE *error* — Furniture rotation must be a quarter-turn. **Cause.** A furniture item's `rotate` is not one of 0, 90, 180, or 270 degrees. **Fix.** Use a quarter-turn: `rotate 0|90|180|270`. ```arch furniture wc at (0,0) size 400x700 rotate 45 # error: not a quarter-turn ``` ## E_FURN_SIZE *error* — Furniture must have a positive size. **Cause.** A furniture item's width or height evaluated to zero or a negative number. **Fix.** Give the item a positive `size W x H`. ```arch furniture bed at (0,0) size 0x2000 # error ``` ## E_IMPORT_BAD_SPEC *error* — Malformed import spec. **Cause.** The string after `import` is not a recognizable module reference. **Fix.** Use a relative path ("lib/x.arch") or a namespaced spec ("@scope/name:1.0.0"). ```arch import "???" : a # error ``` ## E_IMPORT_CONFLICT *error* — Imported name conflicts with an existing component. **Cause.** An imported component has the same name as one already defined or imported. **Fix.** Rename with `as`, or remove the duplicate. ```arch import "lib.arch": bed as lib_bed ``` ## E_IMPORT_CYCLE *error* — Cyclic import. **Cause.** Modules import each other in a cycle, which cannot be resolved. **Fix.** Break the cycle so module dependencies form a tree. ```arch # a.arch imports b.arch which imports a.arch → error ``` ## E_IMPORT_NOT_EXPORTED *error* — Imported name is not exported by the module. **Cause.** The module has no component with the requested name. **Fix.** Import a name the module actually defines (check its `component`s). ```arch import "lib.arch": nope # error if lib.arch has no `component nope` ``` ## E_IMPORT_NOT_FOUND *error* — Import path could not be resolved. **Cause.** The World could not read the module at the given path. **Fix.** Check the path (relative to the importing file) and that the file exists. ```arch import "lib/missing.arch": a # error ``` ## E_IMPORT_PARSE *error* — Imported module has a parse error. **Cause.** The module referenced by `import` does not itself parse. **Fix.** Fix the syntax error in the imported module. ```arch # error originates in the imported file ``` ## E_INDEX *error* — Array index out of range. **Cause.** `arr[i]` used an index outside `0 .. len(arr) - 1`. **Fix.** Clamp or check the index against `len(arr)`. ```arch let a = [1, 2] let x = a[5] # error ``` ## E_LAYOUT_CYCLE *error* — Relational room placement forms a cycle. **Cause.** Rooms placed with `right-of`/`below`/… reference each other in a loop, so no order resolves them. **Fix.** Break the cycle by giving one of the rooms absolute `at (x,y)` coordinates. ```arch room id=a right-of b size 100x100 room id=b left-of a size 100x100 # error: a ↔ b cycle ``` ## E_LAYOUT_REF *error* — Relational placement references an unknown room. **Cause.** A `right-of`/`below`/… clause names a room id that does not exist in the plan. **Fix.** Reference an existing room id, or fix the typo. ```arch room id=k right-of ghost size 100x100 # error: no room "ghost" ``` ## E_OPENING_WIDTH *error* — Opening must have a positive width. **Cause.** A cased opening's width evaluated to zero or a negative number. **Fix.** Give the opening a positive `width`. ```arch opening at (0,0) width 0 # error ``` ## E_RANGE_LIMIT *error* — Range too large. **Cause.** A `lo..hi` range would expand to more elements than the safety cap allows. **Fix.** Use a smaller range, or restructure to avoid materializing it. ```arch for i in 0..1000000 { … } # error: range too large ``` ## E_RECURSION *error* — Component recursion too deep. **Cause.** Component instantiation nested beyond the depth limit (usually unbounded self-instantiation). **Fix.** Add a base case so the recursion terminates. ```arch component r(n) { r(n) } # error: never terminates ``` ## E_REDEF *error* — Name already defined in this scope. **Cause.** A `let` re-declares a name already bound in the same scope. **Fix.** Rename one binding, or use `NAME = …` to reassign instead of redeclaring. ```arch let x = 1 let x = 2 # error: redefinition ``` ## E_ROOM_SIZE *error* — Room must have a positive size. **Cause.** A room's width or height evaluated to zero or a negative number. **Fix.** Give the room a positive `size W x H`. ```arch room at (0,0) size 0x4000 # error: width is 0 ``` ## E_TYPE *error* — Type mismatch. **Cause.** A value was used where another type was required (e.g. a string where a number is expected, or a non-array in `for`). **Fix.** Convert or supply the expected type. ```arch room at (0,0) size "big" x 10 # error: size needs numbers ``` ## E_UNKNOWN_COMPONENT *error* — Unknown component. **Cause.** An instance calls a component name that is not defined or imported. **Fix.** Define the component, import it, or fix the name (see the suggestion hint). ```arch sofa(0, 0) # error if no `component sofa` is in scope ``` ## E_UNKNOWN_FN *error* — Unknown function. **Cause.** A call uses a name that is neither a built-in nor a value-function in scope. **Fix.** Define it with `let f(…) = …`, or fix the name. ```arch let x = frobnicate(2) # error ``` ## E_UNKNOWN_REF *error* — Unknown reference. **Cause.** An expression references a name that is not bound in scope. **Fix.** Declare it with `let`, pass it as a parameter, or fix the typo. ```arch let x = y + 1 # error if `y` is undefined ``` ## E_WALL_THICKNESS *error* — Wall must have a positive thickness. **Cause.** A wall's `thickness` evaluated to zero or a negative number. **Fix.** Give the wall a positive `thickness`. ```arch wall exterior thickness 0 { (0,0) (1,0) } # error ``` ## E_WHILE_LIMIT *error* — `while` exceeded its iteration cap. **Cause.** A `while` ran more times than the safety cap allows (usually a condition that never becomes false). **Fix.** Ensure the loop body updates a binding so the condition eventually fails. ```arch let i = 0 while i < 1 { column at (0,0) size 1x1 } # error: i never changes ``` ## E_WINDOW_WIDTH *error* — Window must have a positive width. **Cause.** A window's width evaluated to zero or a negative number. **Fix.** Give the window a positive `width`. ```arch window at (0,0) width 0 # error ``` ## W_BATH_VIA_BEDROOM *warning* — Bathroom is reachable only through a bedroom. **Cause.** Every door path from the entrance to this bathroom/WC passes through a bedroom. That is fine for a private en-suite, but a dwelling's main bathroom should open off circulation (a hall or living space), not a bedroom. **Fix.** Add a door connecting the bathroom to a hall/living space, or route circulation so it is not reached only via a bedroom. ```arch door id=d_bath at (5200,4000) width 800 wall partition # lint: bath only off the bedroom ``` ## W_BEDROOM_NO_WINDOW *warning* — Bedroom has no window. **Cause.** A room labelled as a bedroom has no window on its perimeter (natural light / egress). **Fix.** Add a `window` on an exterior wall of the room. ```arch room at (0,0) size 3000x4000 label "Bedroom" # lint: no window ``` ## W_DOOR_CLEARANCE *warning* — Door is narrower than the minimum clear width. **Cause.** A door's width is below the configured minimum passable width (default 700 mm). **Fix.** Widen the door to at least the minimum clear width. ```arch door at (0,0) width 500 wall exterior # lint: under 700 mm ``` ## W_DOOR_OFF_WALL *warning* — Door does not lie on any wall. **Cause.** A door's position is not within tolerance of any wall segment, so it has no host. **Fix.** Move the door onto a wall, or name its host with `wall `. The diagnostic points at the nearest wall. ```arch door at (9999,9999) width 900 # warning: not on a wall ``` ## W_EMPTY_PLAN *warning* — Empty plan. **Cause.** The plan resolved to no drawable elements. **Fix.** Add at least one element (wall, room, …). ```arch plan "Empty" { units mm } # warning ``` ## W_FIXTURE_FLOATING *warning* — A plumbing/kitchen fixture is not against a wall. **Cause.** A fixture that conventionally needs a wall behind it (WC, basin, shower, sink, counter, stove, fridge…) sits with no wall backing any edge — it appears to float in the middle of the room. **Fix.** Move the fixture so one edge is against a wall (supply/waste/venting runs in the wall), or remove it. ```arch furniture wc at (3000,3000) size 400x700 # lint: no wall behind it ``` ## W_FIXTURE_WRONG_ROOM *warning* — Fixture sits outside its declared room. **Cause.** A furniture item declared `in ` has its centre outside that room's rectangle, so it is drawn in the wrong space. **Fix.** Move the fixture inside the named room, or correct the `in `. ```arch furniture wc at (100,100) size 400x700 in bath # lint: centre is not inside "bath" ``` ## W_FURN_CLEARANCE *warning* — A fixture's use-space is blocked. **Cause.** The activity clearance directly in front of a fixture (WC, basin, sink, counter, stove…) is intruded by a free-standing piece of furniture, so the fixture can't be used comfortably. Other plumbing/kitchen fixtures are ignored, so a compact bathroom/kitchen run does not trip this. **Fix.** Leave the catalogued clearance clear in front of the fixture, or move the obstructing furniture. ```arch furniture stove at (0,0) size 600x600 furniture sofa at (0,650) size 2000x900 # lint: sofa blocks the stove front ``` ## W_FURNITURE_OVERLAP *warning* — Two pieces of furniture overlap. **Cause.** Two furniture/fixture rectangles occupy the same floor area, so they would physically collide — usually a coordinate or size mistake. **Fix.** Move or resize one so they no longer intersect; leave a walkway between them. ```arch furniture sofa at (300,300) size 2000x900 furniture bed at (1000,500) size 1500x2000 # lint: overlaps the sofa ``` ## W_HATCH_SCALE *warning* — Hatch scale must be positive; using 1. **Cause.** A wall material `scale` evaluated to zero or a negative number. **Fix.** Use a positive `scale`. ```arch wall exterior thickness 200 material brick scale 0 { (0,0) (1,0) } ``` ## W_NO_ENTRANCE *warning* — The plan has no exterior door. **Cause.** The plan has rooms and an exterior wall but no door hosted on an exterior wall, so the building cannot be entered. **Fix.** Add a `door` on an `exterior` wall. ```arch wall exterior thickness 200 { (0,0) (4000,0) (4000,3000) (0,3000) close } # lint: no way in ``` ## W_OPENING_OFF_WALL *warning* — Opening does not lie on any wall. **Cause.** A cased opening's position is not within tolerance of any wall segment, so it has no host. **Fix.** Move the opening onto a wall, or name its host with `wall `. The diagnostic points at the nearest wall. ```arch opening at (9999,9999) width 1000 # warning: not on a wall ``` ## W_ROOM_DISCONNECTED *warning* — Room has no door — it can't be entered. **Cause.** No door lies on any of the room's walls, so there is no way into the room. **Fix.** Add a `door` on one of the room's walls. ```arch room id=r at (0,0) size 3000x3000 # lint: no door on its perimeter ``` ## W_ROOM_NO_FIXTURE *warning* — Bathroom or kitchen has no fixtures. **Cause.** A room labelled as a bathroom or kitchen contains no plumbing/kitchen fixture (WC, basin, shower, sink, counter…), so it is drawn as an empty box. **Fix.** Place the expected fixtures — e.g. import `lib/fixtures.arch` and add a `wc`, `basin`, `shower`, or `kitchen_sink`. ```arch room at (4000,4000) size 3000x2000 label "Bath" # lint: no fixtures inside ``` ## W_ROOM_NOT_ENCLOSED *warning* — Bathroom is not fully enclosed. **Cause.** A run of this bathroom/WC's perimeter is not backed by a wall, so it is open to the adjacent space — a privacy problem for a wet room (a partition that stops short is the usual cause). **Fix.** Extend the partition so the room's perimeter is walled on all sides (a door/window in the wall is fine — only a missing wall counts). ```arch wall partition thickness 100 { (4000,0) (4000,4000) } # lint: stops short, bath left open ``` ## W_ROOM_OVERLAP *warning* — Rooms overlap. **Cause.** Two room rectangles intersect. **Fix.** Adjust positions/sizes if the overlap is unintended (it is allowed). ```arch room at (0,0) size 2000x2000 room at (1000,0) size 2000x2000 # warning ``` ## W_ROOM_TOO_SMALL *warning* — Room is implausibly small. **Cause.** A room's floor area is below the configured minimum (default 4 m²). **Fix.** Increase its `size`, or merge it into an adjacent space. ```arch room at (0,0) size 1000x1000 label "Closet" # lint: 1 m² ``` ## W_ROOM_UNREACHABLE *warning* — Room cannot be reached from the entrance. **Cause.** The building has an entrance, but this room has no door/opening path back to the exterior — it is sealed off from the circulation. **Fix.** Add a door or cased `opening` linking it (directly or through a hall) to a space that reaches the entrance. ```arch room at (5000,0) size 3000x3000 label "Store" # lint: no path from the entrance ``` ## W_SANITIZED_CONFIG *warning* — A disallowed config value was stripped. **Cause.** A theme/style value contained markup or a `data:` URL and was blanked for safety. **Fix.** Use a plain colour/string value (no `<`, `>`, or `url(data:…)`). ```arch theme { wall: "