Diagnostic codes
generated from midad spec --json at build time; not edited by hand
100 codes. Every refusal midad makes carries one; the table below is the same table the binary reads, so midad explain CODE and this page cannot disagree.
Frontmatter and files 6
| code | severity | message |
|---|---|---|
E0001 | error | not an executable midad file: missing YAML frontmatter with a midad: version key |
E0002 | error | frontmatter is never closed with --- |
E0003 | error | unsupported language version {} (this parser supports "0.1") |
E0004 | error | invalid module name {} |
E0005 | error | invalid frontmatter: {e} |
E0006 | error | frontmatter has both midad: and mdx: version keys |
Syntax 27
| code | severity | message |
|---|---|---|
E0100 | error | - |
E0101 | error | {open} is never closed |
E0102 | error | blocks are nested too deeply |
E0110 | error | invalid command name {name} |
E0111 | error | a ``fn block holdsfunction name(param: type): return {` declarations |
E0120 | error | expected name: type = value; |
E0121 | error | unknown type {t} |
E0130 | error | parameter must look like name: type |
E0140 | error | signature must look like (number, float) -> float |
E0141 | error | unknown native field; expected lib, symbol or sig |
E0142 | error | native block needs both lib: and symbol: |
E0150 | error | unknown ai:intent field; expected name, input, output, prompt or fallback |
E0151 | error | ai:intent needs name:, output: and prompt: |
E0160 | error | invalid variable name {name} |
E0161 | error | {kw} wants the {{ at the end of the line, with the body on the lines below |
E0162 | error | {kw} block is missing a closing }} |
E0163 | error | unexpected text after }}: {rest} |
E0164 | error | if let supports the Some(name), Ok(name) and Err(name) patterns |
E0165 | error | expected ; at the end of the statement |
E0166 | error | for needs an opening brace at the end of the line: for x in xs { |
E0170 | error | unknown HTTP method {method} |
E0171 | error | route path must start with /, e.g. ```route:GET /items/:id |
E0172 | error | invalid route handler {h} |
E0173 | error | route {} {} names handler {} and also has statements |
E0180 | error | invalid type name {n} |
E0181 | error | invalid interface name {name} |
E0182 | error | a ``types block holdstype Name = andinterface Name {` declarations |
Names, types and statements 33
| code | severity | message |
|---|---|---|
E0200 | error | {name} is already defined |
E0201 | error | state {} is declared twice |
E0202 | error | state initializers must be constant literals |
E0203 | error | {name} is already declared in this scope |
E0204 | error | route {} {} is defined twice |
E0210 | error | function {} returns {} but not every path returns a value |
E0220 | error | entry point {e} is not defined by any fn block |
E0221 | error | entry point {e} must take no parameters |
E0222 | error | no entry point: set entry: in the frontmatter, define fn:main, a route, a command, or an exec block |
E0230 | error | type mismatch: expected {}, found {} |
E0231 | error | cannot bind a void value |
E0232 | error | return needs a {} value |
E0233 | error | this block returns no value |
E0234 | error | cannot assign to {name}: it is a const |
E0235 | error | {word} outside a loop |
E0240 | error | assignment to undeclared variable {name} |
E0241 | error | unknown variable {n} |
E0242 | error | unknown function {name} |
E0243 | error | if let {} needs {}, found {} |
E0260 | error | {name}(...) changes its first argument in place and answers nothing, so it has no value to use here |
E0245 | error | ? needs an option or result value, found {} |
E0246 | error | ? can only be used in a function that returns an option or result (this one returns {}) |
E0247 | error | the par accumulator {acc} is {}; only a number can be summed across threads |
E0248 | error | in a par body {acc} can only be updated as {acc} = {acc} + value |
E0249 | error | return is not allowed inside a par body |
E0250 | error | a par body cannot contain another par |
E0251 | error | html:{name} block is empty |
E0252 | error | html:{name} is defined twice |
E0253 | error | html:{name}: {m} |
E0254 | error | no html:{t} block in this program |
E0255 | error | a before block runs before a route, and this program has no routes |
E0256 | error | route handler {} is not a function in this program |
E0257 | error | route handler {} must take one map and return a map |
Permissions, imports and projects 22
| code | severity | message |
|---|---|---|
E0300 | error | {name} is not permitted: missing {cap} permission (E0300 has one message per refusal: this one, a computed target that needs a grant, and eval_source without eval: true) |
E0301 | error | native library {} requires the ffi permission |
E0302 | error | ai:intent {} requires ai: true in permissions |
E0303 | error | routes require the listen permission |
E0304 | error | persist: {p} needs both fs_read and fs_write permission for that path |
E0305 | error | static: "{dir}" serves a directory, so it needs an fs_read grant that covers it |
E0310 | error | import cycle: {} |
E0311 | error | - |
E0312 | error | two imported files are both module {alias} |
E0313 | error | import {imp} must name a .md file |
E0314 | error | {} is imported but is not a midad program |
E0315 | error | this file is imported, so its exec block will not run |
E0316 | error | this file is imported, so its routes will not be served |
E0317 | error | this file is imported, so its commands will not exist |
E0318 | error | {alias} cannot be a module alias |
E0319 | error | this file is imported, so its before block will not run |
E0341 | error | {n} is a function, and a function name is not a value here |
E0342 | error | {n} has a fn parameter itself, so it cannot be passed as one |
E0343 | error | fn is only a parameter type, not {what} |
E0344 | error | {} takes {} arguments, this passes {} |
E0345 | error | {n} is a fn parameter, so it cannot be assigned or reused as a variable name |
E0346 | error | {n} is both a variable here and the name of a function |
Layout 3
Warnings 9
| code | severity | message |
|---|---|---|
W001 | warning | {} has no midad.toml; using {} as the entry |
W002 | warning | import {imp} reaches outside the project directory |
W003 | warning | {} has changed since it was vendored from {}: run midad vendor {} to refresh it, or delete {}/.vendor if you meant to fork it |
W004 | warning | module {} does not match the file name {stem} |
W005 | warning | function {shown} is not snake_case |
W006 | warning | state {shown} is not snake_case |
W007 | warning | imported module {shown} is outside the conventional layout |
W008 | warning | / now yields a float, so this is not integer division |
W009 | warning | {} takes a fn parameter and is never called, so its body is not checked |