---
name: "Diagnostics"
---

# Diagnostic codes

Every type-checker error and warning carries a stable `AG####` code, and
every `agency lint` finding carries a stable `AL####` code.
Look one up with `agency explain <code>` (e.g. `agency explain AG2005`),
or suppress a type-checker one on the next line with `// @tc-ignore AG####`.

## Types and aliases

| Code | Message |
| --- | --- |
| [AG1001](types-aliases.md#ag1001) | Type parameter '&#123;param&#125;' (no default) must come before parameters that have defaults in '&#123;alias&#125;'. |
| [AG1002](types-aliases.md#ag1002) | Type '&#123;alias&#125;' is not a value-parameterized type but was given &#123;count&#125; value &#123;argumentWord&#125; (referenced in '&#123;context&#125;'). |
| [AG1003](types-aliases.md#ag1003) | &#123;alias&#125; expects at most &#123;max&#125; value &#123;argumentWord&#125;, got &#123;count&#125; (referenced in '&#123;context&#125;'). |
| [AG1004](types-aliases.md#ag1004) | '&#123;alias&#125;' is a value-parameterized type and requires value arguments — write '&#123;alias&#125;(&#123;formals&#125;)' (referenced in '&#123;context&#125;'). |
| [AG1005](types-aliases.md#ag1005) | &#123;alias&#125; requires at least &#123;min&#125; value &#123;argumentWord&#125; (referenced in '&#123;context&#125;'). |
| [AG1006](types-aliases.md#ag1006) | Type alias '&#123;alias&#125;' is not defined (referenced in '&#123;context&#125;'). |
| [AG1007](types-aliases.md#ag1007) | Generic type '&#123;alias&#125;' requires type arguments (referenced in '&#123;context&#125;'). |
| [AG1008](types-aliases.md#ag1008) | &#123;alias&#125; expects &#123;expected&#125; type &#123;argumentWord&#125;, got &#123;count&#125; (referenced in '&#123;context&#125;'). |
| [AG1009](types-aliases.md#ag1009) | Unknown generic type '&#123;alias&#125;' (referenced in '&#123;context&#125;'). |
| [AG1010](types-aliases.md#ag1010) | Type '&#123;alias&#125;' is not a generic type (referenced in '&#123;context&#125;'). |
| [AG1011](types-aliases.md#ag1011) | &#123;alias&#125; expects at most &#123;max&#125; type &#123;argumentWord&#125;, got &#123;count&#125; (referenced in '&#123;context&#125;'). |
| [AG1012](types-aliases.md#ag1012) | &#123;alias&#125; requires at least &#123;min&#125; type &#123;argumentWord&#125; (referenced in '&#123;context&#125;'). |
| [AG1013](types-aliases.md#ag1013) | `&#123;name&#125;` is not a type; &#123;hint&#125; |
| [AG1014](types-aliases.md#ag1014) | Cannot cast `&#123;from&#125;` to `&#123;to&#125;` because neither type fits the other. If this is intentional, write `&#123;expr&#125; as unknown as &#123;to&#125;`. |
| [AG1015](types-aliases.md#ag1015) | A checked cast validates the value at runtime, and `&#123;type&#125;` has no schema to validate against. Remove the `!` to cast without checking. |
| [AG1016](types-aliases.md#ag1016) | A cast is not allowed in this position. Add parentheses: `(&#123;left&#125; &#123;op&#125; &#123;right&#125;) as &#123;type&#125;` or `&#123;left&#125; &#123;op&#125; (&#123;right&#125; as &#123;type&#125;)`. |
| [AG1017](types-aliases.md#ag1017) | This checked cast runs validators that can pause the program, and it cannot be resumed safely in this position. Move it to its own line: `const value = &#123;cast&#125;`. |
| [AG1018](types-aliases.md#ag1018) | `&#123;expr&#125;` is a `&#123;from&#125;`. A cast does not unwrap it. Unwrap the Result first, with `match` or `catch`, then cast the value if you still need to. |
| [AG1019](types-aliases.md#ag1019) | `&#123;cast&#125;` runs validators that can pause the program, and a module-level initializer or a parameter default cannot pause. Do the cast inside a node or a def. |
| [AG1020](types-aliases.md#ag1020) | `&#123;cast&#125;` runs validators that can pause the program, and a handler body cannot pause. Do the cast before the `handle` block and use the value here. |
| [AG1021](types-aliases.md#ag1021) | `&#123;expr&#125;?` cannot be lowered in this position. Move it to its own line: `const value = &#123;expr&#125;?`. |
| [AG1022](types-aliases.md#ag1022) | `&#123;expr&#125;?` returns from a function, and a module-level initializer or a parameter default is not inside one. Use it inside a node or a def. |
| [AG1023](types-aliases.md#ag1023) | `&#123;expr&#125;?` cannot be used inside a handler body. Unwrap the Result before the `handle` block, or match on it here. |
| [AG1024](types-aliases.md#ag1024) | `&#123;expr&#125;?` would return from a `parallel` arm, and an arm cannot return early. Do the unwrap inside a def the arm calls. |
| [AG1025](types-aliases.md#ag1025) | `&#123;expr&#125;?` cannot be a write target. Unwrap into a variable first, then assign to its field. |

## Assignability and checking

| Code | Message |
| --- | --- |
| [AG2001](checking.md#ag2001) | Type '&#123;actual&#125;' is not assignable to type '&#123;expected&#125;' (&#123;context&#125;). |
| [AG2002](checking.md#ag2002) | Type '&#123;actual&#125;' is not assignable to type 'boolean' (condition). |
| [AG2003](checking.md#ag2003) | Unknown property '&#123;key&#125;' on type '&#123;expected&#125;' (&#123;context&#125;). |
| [AG2004](checking.md#ag2004) | Variable '&#123;name&#125;' has no type annotation (strict mode). |
| [AG2005](checking.md#ag2005) | Type '&#123;actual&#125;' is not assignable to type '&#123;expected&#125;'. |
| [AG2006](checking.md#ag2006) | For-loop iterable must be an array or Record, got '&#123;actual&#125;'. |
| [AG2007](checking.md#ag2007) | &#123;kind&#125; '&#123;name&#125;' has validated parameters but its return type is not a Result type. Validated parameters can short-circuit with a failure, so the return type must be 'Result&lt;...&gt;'. |
| [AG2008](checking.md#ag2008) | Property '&#123;field&#125;' is not available on every member of '&#123;union&#125;'; narrow the value (e.g. with a guard) before accessing it. |
| [AG2009](checking.md#ag2009) | '.&#123;field&#125;' is only available on a &#123;branch&#125; Result; guard with 'if (isSuccess(r))' / 'if (isFailure(r))', use 'r catch …', or 'match (r) &#123; … &#125;'. |
| [AG2010](checking.md#ag2010) | Cannot &#123;op&#125; values of different dimensions (&#123;leftDim&#125; and &#123;rightDim&#125;): '&#123;left&#125;' and '&#123;right&#125;'. |
| [AG2011](checking.md#ag2011) | Property '&#123;property&#125;' does not exist on type '&#123;type&#125;'. |
| [AG2012](checking.md#ag2012) | Not all code paths return a value in '&#123;fn&#125;'. |
| [AG2013](checking.md#ag2013) | The first argument to failure() is the message shown to a person or a model, so it must be a string. Got '&#123;actual&#125;'. |
| [AG2014](checking.md#ag2014) | The second argument to failure() is its structured data, so it must be an object. Got '&#123;actual&#125;'. |
| [AG2015](checking.md#ag2015) | This function declares '&#123;expected&#125;' as its failure data, so failure() needs a second argument. To allow a failure with no data, declare the return type as 'Result&lt;&#123;success&#125;, &#123;expected&#125; \| null&gt;'. |
| [AG2016](checking.md#ag2016) | A Result's second type parameter is its failure data, and failure data must be an object. Got '&#123;actual&#125;' (&#123;context&#125;). A failure's message is always a string and is not named in the type. |
| [AG2017](checking.md#ag2017) | failure() cannot take a splat. Codegen appends the checkpoint and function name to every failure() call by position, and a splat of unknown width would displace them. Pass the message and data directly. |
| [AG2018](checking.md#ag2018) | The body of '&#123;target&#125;' returns '&#123;actual&#125;', but decorator '&#123;name&#125;' takes a block returning '&#123;expected&#125;'. |
| [AG2019](checking.md#ag2019) | Decorator '&#123;inner&#125;' returns '&#123;actual&#125;', but decorator '&#123;name&#125;' above it on '&#123;target&#125;' takes a block returning '&#123;expected&#125;'. |
| [AG2020](checking.md#ag2020) | '&#123;target&#125;' is declared to return '&#123;declared&#125;', but decorator '&#123;name&#125;' returns '&#123;actual&#125;'. |
| [AG2021](checking.md#ag2021) | The body of '&#123;target&#125;' saves a draft of type '&#123;actual&#125;', but decorator '&#123;name&#125;' takes a block returning '&#123;expected&#125;'. |
| [AG2022](checking.md#ag2022) | Parameter '&#123;param&#125;' of '&#123;fn&#125;' has alias '&#123;alias&#125;', which is already the name or an alias of parameter '&#123;other&#125;'. |
| [AG2023](checking.md#ag2023) | `&#123;expr&#125;?` needs a `Result`, and `&#123;expr&#125;` is a `&#123;type&#125;`. Only a `Result` can be unwrapped with `?`. |
| [AG2024](checking.md#ag2024) | `&#123;expr&#125;?` returns a failure from `&#123;name&#125;` when the Result fails, but `&#123;name&#125;` is declared to return `&#123;type&#125;`. Declare it as `Result&lt;&#123;type&#125;&gt;`, or unwrap with `match` or `catch` instead. |

## Interrupts, effects, and handlers

| Code | Message |
| --- | --- |
| [AG3001](effects.md#ag3001) | The '!' validation syntax is not allowed on handler parameters. Validate the data inside the handler body if needed. |
| [AG3002](effects.md#ag3002) | Effect '&#123;effect&#125;' is declared more than once in the same file. |
| [AG3003](effects.md#ag3003) | Conflicting payload types for effect '&#123;effect&#125;'. All declarations of an effect must agree on its payload. |
| [AG3004](effects.md#ag3004) | Named arguments are not allowed on 'raise'/'interrupt'. Pass the data positionally. |
| [AG3005](effects.md#ag3005) | Effect '&#123;effect&#125;' expects data &#123;payload&#125;, but none was supplied. |
| [AG3006](effects.md#ag3006) | Effect '&#123;effect&#125;' data field '&#123;field&#125;' is missing. |
| [AG3007](effects.md#ag3007) | Effect '&#123;effect&#125;' data field '&#123;field&#125;' has the wrong type. |
| [AG3008](effects.md#ag3008) | Effect '&#123;effect&#125;' data does not match the declared &#123;payload&#125;. |
| [AG3009](effects.md#ag3009) | Function '&#123;fn&#125;' may throw interrupts [&#123;effects&#125;] but is not inside a handler. |
| [AG3011](effects.md#ag3011) | `interrupt` is not allowed inside a callback body (callback registered on '&#123;hook&#125;' may raise [&#123;effects&#125;]). Callbacks fire as side effects; their body cannot pause execution to ask the user a question. Move the `interrupt` into the calling node/function instead, or use a runtime guard if you wanted budget enforcement. |
| [AG3012](effects.md#ag3012) | 'raises &#123;ref&#125;' is not an effect set. Declare '&#123;ref&#125;' with 'effectSet' (not 'type'), or use an inline set like '&lt;...&gt;'. |
| [AG3013](effects.md#ag3013) | &#123;kind&#125; '&#123;name&#125;' raises effect '&#123;effect&#125;', which exceeds its declared 'raises &#123;declared&#125;'. Add '&#123;effect&#125;' to the clause. |
| [AG3014](effects.md#ag3014) | &#123;who&#125; may raise any effect (its type has no 'raises' clause), which exceeds the 'raises &lt;&#123;allowed&#125;&gt;' allowed by type '&#123;type&#125;'. Add a 'raises' clause to the value's type. |
| [AG3015](effects.md#ag3015) | &#123;who&#125; raises effect '&#123;effect&#125;', which exceeds the 'raises &lt;&#123;allowed&#125;&gt;' allowed by type '&#123;type&#125;'. Add '&#123;effect&#125;' to the clause, or use a target type that allows it. |
| [AG3016](effects.md#ag3016) | '&#123;callee&#125;' can interrupt, and a finalize block cannot contain interrupts. A finalize runs while its scope shuts down, so there is nothing to resume. |
| [AG3017](effects.md#ag3017) | Cannot use &#123;kind&#125; at the top level of a file. Top-level code runs at initialization, which cannot branch, loop, or wait — move it inside a node or a function. |
| [AG3018](effects.md#ag3018) | A handler cannot be registered at the top level of a file. Handlers must be inside a node or a function, where there is execution for them to guard. |
| [AG3019](effects.md#ag3019) | @&#123;tag&#125; names '&#123;field&#125;', which effect '&#123;effect&#125;' does not carry. |
| [AG3020](effects.md#ag3020) | @&#123;tag&#125; arguments must be bare field names, each named once (effect '&#123;effect&#125;'). |
| [AG3021](effects.md#ag3021) | @&#123;tag&#125; appears more than once on effect '&#123;effect&#125;'. |
| [AG3022](effects.md#ag3022) | Conflicting @always scopes for effect '&#123;effect&#125;'. All tagged declarations of an effect must agree. |
| [AG3023](effects.md#ag3023) | @&#123;tag&#125; is only valid on an effect declaration. |
| [AG3024](effects.md#ag3024) | Unknown capability '&#123;name&#125;' on '&#123;callable&#125;'. Did you mean '&#123;suggestion&#125;'? The capabilities are &#123;known&#125;. |
| [AG3025](effects.md#ag3025) | @capabilities arguments must be bare capability names (on '&#123;callable&#125;'). |
| [AG3026](effects.md#ag3026) | @capabilities appears more than once on '&#123;callable&#125;'. |
| [AG3028](effects.md#ag3028) | @capabilities goes on a def or a node.&#123;hint&#125; |
| [AG3029](effects.md#ag3029) | &#123;kind&#125; '&#123;name&#125;' needs the &#123;capability&#125; capability, which the &#123;platform&#125; platform does not have. &#123;path&#125; |
| [AG3030](effects.md#ag3030) | &#123;kind&#125; '&#123;name&#125;' raises effect '&#123;effect&#125;', which exceeds its declared 'raises &#123;declared&#125;'. It is raised by decorator '&#123;decorator&#125;'. Add '&#123;effect&#125;' to the clause. |

## Names, scope, and reserved words

| Code | Message |
| --- | --- |
| [AG4001](names.md#ag4001) | '&#123;name&#125;' shadows an imported function. |
| [AG4002](names.md#ag4002) | '&#123;name&#125;' is a reserved built-in; cannot be redefined. |
| [AG4003](names.md#ag4003) | '&#123;name&#125;' is a reserved built-in type; cannot be redefined. |
| [AG4004](names.md#ag4004) | Function '&#123;name&#125;' is not defined. |
| [AG4005](names.md#ag4005) | Cannot reassign to constant '&#123;name&#125;'. |
| [AG4006](names.md#ag4006) | `&#123;keyword&#125;` is a reserved block keyword. Write `&#123;keyword&#125; &#123; ... &#125;` or `&#123;keyword&#125;(args) &#123; ... &#125;` directly — the `as` keyword is not supported on &#123;keyword&#125; blocks (there's nothing to bind). |
| [AG4007](names.md#ag4007) | Variable '&#123;name&#125;' is not defined. |
| [AG4008](names.md#ag4008) | '&#123;name&#125;' is not defined in '&#123;module&#125;'. |
| [AG4009](names.md#ag4009) | Cannot find module '&#123;module&#125;'. |
| [AG4010](names.md#ag4010) | '&#123;name&#125;' is defined in '&#123;module&#125;' but is not exported. Add the 'export' keyword to its definition. |
| [AG4011](names.md#ag4011) | '&#123;name&#125;' is not accessible under --agency-only. It reaches JavaScript's Function or prototype chain, which pure Agency code may not use. |
| [AG4012](names.md#ag4012) | Cannot redeclare parameter '&#123;name&#125;' with '&#123;declKind&#125;'. Reads after the redeclare would still see the parameter. Assign to it instead, or pick a different name. |
| [AG4013](names.md#ag4013) | &#123;violation&#125; |

## Match and narrowing

| Code | Message |
| --- | --- |
| [AG5002](match.md#ag5002) | match is not exhaustive: missing &#123;missing&#125;. |
| [AG5003](match.md#ag5003) | `&#123;name&#125;` here binds the value; it does not test the type. Did you mean `p: &#123;name&#125;` or `is &#123;name&#125;`? |

## Calls, tools, and LLM usage

| Code | Message |
| --- | --- |
| [AG6001](tools.md#ag6001) | 'regex' cannot appear in an llm() structured-output type (&#123;context&#125;); LLMs can't return regex values through JSON. |
| [AG6002](tools.md#ag6002) | Cannot interpolate parameter '&#123;param&#125;' in doc string — parameter values are not known when the tool description is sent to the LLM. Use a global variable instead. |
| [AG6003](tools.md#ag6003) | .partial() requires named arguments, e.g. fn.partial(a: 5). |
| [AG6004](tools.md#ag6004) | Unknown parameter '&#123;name&#125;' in .partial() call. '&#123;fn&#125;' has parameters: &#123;params&#125;. |
| [AG6005](tools.md#ag6005) | Argument type '&#123;actual&#125;' is not assignable to parameter type '&#123;expected&#125;' in .partial() call to '&#123;fn&#125;'. |
| [AG6006](tools.md#ag6006) | Named arguments are not supported on built-in method '.&#123;method&#125;()'. |
| [AG6007](tools.md#ag6007) | Method '.&#123;method&#125;()' expects &#123;expected&#125; argument(s), got &#123;count&#125;. |
| [AG6008](tools.md#ag6008) | Method '.&#123;method&#125;()' expects at least &#123;min&#125; argument(s), got &#123;count&#125;. |
| [AG6009](tools.md#ag6009) | Method '.&#123;method&#125;()' expects &#123;min&#125;–&#123;max&#125; argument(s), got &#123;count&#125;. |
| [AG6010](tools.md#ag6010) | Argument type '&#123;actual&#125;' is not assignable to parameter type '&#123;expected&#125;' in call to '.&#123;method&#125;()'. |
| [AG6011](tools.md#ag6011) | Named arguments can only be used with Agency-defined functions, not '&#123;fn&#125;'. |
| [AG6012](tools.md#ag6012) | '&#123;fn&#125;' does not accept the named argument '&#123;name&#125;'. Allowed: &#123;allowed&#125;. |
| [AG6013](tools.md#ag6013) | Duplicate named argument '&#123;name&#125;' in call to '&#123;fn&#125;'. |
| [AG6014](tools.md#ag6014) | Named argument '&#123;name&#125;' on '&#123;fn&#125;' expects type '&#123;expected&#125;', got '&#123;actual&#125;'. |
| [AG6015](tools.md#ag6015) | '&#123;fn&#125;' does not accept a block argument. |
| [AG6016](tools.md#ag6016) | Expected &#123;expected&#125; argument(s) for '&#123;fn&#125;', but got &#123;count&#125;. |
| [AG6017](tools.md#ag6017) | Expected at least &#123;min&#125; argument(s) for '&#123;fn&#125;', but got &#123;count&#125;. |
| [AG6018](tools.md#ag6018) | Expected &#123;min&#125;-&#123;max&#125; argument(s) for '&#123;fn&#125;', but got &#123;count&#125;. |
| [AG6019](tools.md#ag6019) | Argument type '&#123;actual&#125;' is not assignable to parameter type '&#123;expected&#125;' in call to '&#123;fn&#125;'. |
| [AG6020](tools.md#ag6020) | Splat argument must be an array, got '&#123;actual&#125;' in call to '&#123;fn&#125;'. |
| [AG6021](tools.md#ag6021) | Splat element type '&#123;actual&#125;' is not assignable to parameter type '&#123;expected&#125;' in call to '&#123;fn&#125;'. |
| [AG6022](tools.md#ag6022) | Type '&#123;actual&#125;' is not assignable to pipe slot of type '&#123;expected&#125;'. |
| [AG6023](tools.md#ag6023) | Splat argument cannot follow a named argument in call to '&#123;fn&#125;'. |
| [AG6024](tools.md#ag6024) | Positional argument cannot follow a named argument in call to '&#123;fn&#125;'. |
| [AG6025](tools.md#ag6025) | Unknown named argument '&#123;name&#125;' in call to '&#123;fn&#125;'. &#123;valid&#125; |
| [AG6026](tools.md#ag6026) | Named argument '&#123;name&#125;' conflicts with positional argument at position &#123;position&#125; in call to '&#123;fn&#125;'. |
| [AG6027](tools.md#ag6027) | Positional argument cannot feed variadic parameter '&#123;param&#125;' when it is also bound by name in call to '&#123;fn&#125;'. |
| [AG6028](tools.md#ag6028) | Tool '&#123;tool&#125;' has a required function-typed parameter '&#123;param&#125;' that is unbound. Bind it with .partial(&#123;param&#125;: &lt;value&gt;) before passing it as a tool. |
| [AG6029](tools.md#ag6029) | Tool '&#123;tool&#125;' has a required function-typed parameter '&#123;param&#125;' that is unbound (its type is &#123;type&#125;). Bind it with .partial(&#123;param&#125;: &lt;value&gt;) before passing it as a tool. |
| [AG6030](tools.md#ag6030) | Tool '&#123;tool&#125;' will be exposed to the LLM without optional function-typed parameter(s): &#123;params&#125;. The function body must be prepared to run with the declared default for each. |
| [AG6031](tools.md#ag6031) | saveDraft() cannot be called at module top level — there is no enclosing function, node, or block scope to save a draft for. |
| [AG6032](tools.md#ag6032) | A scope can declare at most one finalize block. Combine the logic into one block. |
| [AG6033](tools.md#ag6033) | A finalize block cannot go inside &#123;construct&#125;. Declare it at the top level of the function or block body. A finalize is always active, so nesting it in control flow has no meaning. |
| [AG6034](tools.md#ag6034) | saveDraft() has no effect inside a finalize block. The value the finalize returns is already the partial result. Return the value instead. |
| [AG6035](tools.md#ag6035) | A finalize block cannot go in a node body. Nothing above a node consumes a partial result yet. Put the finalize in a function or a guard block instead. |
| [AG6036](tools.md#ag6036) | This scope has a finalize block, so a return expression cannot bury a call inside a bigger expression. If the call were stopped, the expression would consume its partial result before the finalize could run. Assign the call to a local first, then return the local. |
| [AG6037](tools.md#ag6037) | finalize binder '&#123;name&#125;' collides with a variable that already exists in this scope. Pick a fresh name. The finalize body reads the scope's locals directly, so a colliding binder would silently shadow the local. |
| [AG6038](tools.md#ag6038) | finalize yields a single value — the scope's saved draft. Use one binder: finalize as &#123;name&#125; &#123; ... &#125;. |
| [AG6039](tools.md#ag6039) | Parameter '&#123;name&#125;' on '&#123;fn&#125;' has no default but comes after a defaulted parameter. Put defaulted parameters last, so an omitted argument is always a trailing one. |
| [AG6040](tools.md#ag6040) | '&#123;expr&#125;' is passed as a tool, but it is a value of type '&#123;actual&#125;', not a function.&#123;shadowHint&#125; |
| [AG6041](tools.md#ag6041) | Decorator '&#123;name&#125;' on '&#123;target&#125;' expects '&#123;param&#125;: &#123;expected&#125;', got '&#123;actual&#125;'. |
| [AG6042](tools.md#ag6042) | '&#123;name&#125;' is an alias of parameter '&#123;param&#125;' of '&#123;fn&#125;'. In Agency code, use '&#123;param&#125;'. |
| [AG6043](tools.md#ag6043) | '&#123;name&#125;' is declared as a decorator, but &#123;problem&#125; |
| [AG6044](tools.md#ag6044) | '&#123;name&#125;' is not a decorator, so '@&#123;name&#125;' cannot go on '&#123;target&#125;'. Declare it as `decorator def &#123;name&#125;(...)`. |
| [AG6045](tools.md#ag6045) | '&#123;name&#125;' has a decorator's parameters but is not declared as one: a parameter with a default comes before its last two, which only the call record and the block may follow. Declare it as `decorator def &#123;name&#125;(...)`, or put the defaulted parameter last. |

## Static init, config, and imports

| Code | Message |
| --- | --- |
| [AG7001](static-init.md#ag7001) | Only 'static const' declarations can be exported. Use 'export static const &#123;name&#125; = ...' instead. |
| [AG7002](static-init.md#ag7002) | &#123;contextLabel&#125; cannot call `&#123;builtin&#125;(...)` — &#123;reason&#125;, but static initializers run once at process startup before any per-run state exists. Move this call into a node or a function called from a node. |
| [AG7003](static-init.md#ag7003) | &#123;contextLabel&#125; cannot `interrupt(...)` — interrupts pause the per-run execution stack, but static initializers run once at process startup before any agent run has begun. Move this into a node body. |
| [AG7004](static-init.md#ag7004) | Cannot reassign static `&#123;name&#125;` at module top level — statics are immutable after initialization. Use a global (`const`/`let` without `static`) if you need a mutable value. |
| [AG7005](static-init.md#ag7005) | Cannot mutate static `&#123;name&#125;` via `.&#123;method&#125;(...)` at module top level — statics are deep-frozen after initialization. Use a global (`const`/`let` without `static`) if you need a mutable value. |
| [AG7006](static-init.md#ag7006) | Function '&#123;name&#125;' cannot be both destructive and idempotent — those markers are contradictory. Pick one. |
| [AG7007](static-init.md#ag7007) | Type '&#123;alias&#125;' takes value argument '&#123;name&#125;', which is &#123;what&#125;. A value argument must be a literal, a 'static const', an imported name, or a value parameter of the enclosing type alias. |
| [AG7008](static-init.md#ag7008) | &#123;contextLabel&#125; calls `&#123;fn&#125;`, which may interrupt [&#123;effects&#125;]. Interrupts pause the per-run execution stack, but static initializers run once at process startup before any agent run has begun. Move this into a node body, or answer it at the site by ending the statement with `with approve`. |

## Code templates and holes

| Code | Message |
| --- | --- |
| [AG8001](templates.md#ag8001) | This file is a template with unfilled holes (&#123;names&#125;) and cannot be run directly. Load it with `loadTemplate` and fill it first. |
| [AG8002](templates.md#ag8002) | The hole `#&#123;name&#125;` is in a position that gives it no expected type. Annotate it, for example `#&#123;name&#125;: string`. |
| [AG8003](templates.md#ag8003) | Generator '&#123;name&#125;' may raise &#123;effects&#125;, so it cannot run at compile time. Compilation installs no interrupt handlers, so those operations could not complete anyway. Move the effectful work out of the generator. |
| [AG8004](templates.md#ag8004) | Generator '&#123;name&#125;' cannot be checked for effects: &#123;reason&#125;. An empty effect list from an incomplete reading means nothing, so it is refused rather than run. |
| [AG8005](templates.md#ag8005) | `&#123;name&#125;` must be imported from another file to be used in a splice. A generator cannot be defined in the file that splices it, because it has to be compiled first. |
| [AG8006](templates.md#ag8006) | The generator `&#123;name&#125;` reaches non-Agency code through `&#123;importPath&#125;`. Running a generator loads its file and every file that one imports, and loading a JavaScript module runs it, even when the generator calls nothing from it. JavaScript raises no interrupts and cannot be checked. Move `&#123;name&#125;` into a file that imports only `std::` modules and relative `.agency` files, and check what those files import in turn: one of them importing a JavaScript package is the same problem one step down. If the generator itself needs the JavaScript, set `allowNonAgencyGenerators` in your config, which switches this check off for every generator. |
| [AG8007](templates.md#ag8007) | The generator `&#123;name&#125;` returned a `&#123;actual&#125;` fragment, but this splice is in &#123;position&#125; position and needs a `&#123;expected&#125;` fragment. |
| [AG8008](templates.md#ag8008) | The generator `&#123;name&#125;` failed while running: &#123;reason&#125; |
| [AG8009](templates.md#ag8009) | A generator module cannot itself contain a splice. Move the inner generation into a separate module. |
| [AG8010](templates.md#ag8010) | Generated code refers to `&#123;name&#125;`, which it neither declares nor imports. Generated code may use only names it declares itself and names it imports. |
| [AG8011](templates.md#ag8011) | The splice argument `&#123;name&#125;` is declared in this file, so it does not exist yet when the generator runs. Splice arguments may be literals, code literals, or imported names. |
| [AG8012](templates.md#ag8012) | The generator `&#123;name&#125;` declares `&#123;declared&#125;`, which this file already declares. Generated declarations may not replace existing ones. |
| [AG8013](templates.md#ag8013) | The generator `&#123;name&#125;` produced an exported declaration (`&#123;declared&#125;`). Generated declarations cannot be exported yet, because other files resolve imports without running generators. Remove the `export`. |
| [AG8014](templates.md#ag8014) | The generator `&#123;name&#125;` returned &#123;kind&#125;, which cannot sit at the top level of a file. Top-level code runs at initialization, which cannot branch, loop, or wait. |
| [AG8015](templates.md#ag8015) | `&#123;name&#125;` is not defined in this template. A template can only use names it declares or imports itself, because a hole hides whatever fills it. Move the code that defines `&#123;name&#125;` into this template, or move the code that uses it into the fragment that defines it. |
| [AG8016](templates.md#ag8016) | `&#123;file&#125;` contains a splice, and generator execution was declined for this check, so `&#123;name&#125;` was not run. |
| [AG8017](templates.md#ag8017) | Generated code from `&#123;generator&#125;` uses the name `&#123;name&#125;`. Names starting with two underscores are reserved for the compiler. |

## Lint

| Code | Message |
| --- | --- |
| [AL0001](lint.md#al0001) | '&#123;name&#125;' is imported but never used. |
| [AL0002](lint.md#al0002) | '&#123;name&#125;' is exported but has no docstring. |
| [AL0003](lint.md#al0003) | '&#123;name&#125;' is already available without an import. |
| [AL0004](lint.md#al0004) | failure(&#123;message&#125;) rebuilds '&#123;result&#125;' and drops its flags. Return '&#123;result&#125;' itself. |
