Every message Baa can produce, with a stable code. Codes never change meaning: if BAA102 means one thing today, it means the same thing in every future version. New diagnostics take new numbers.
Each entry has two wordings. The default is sheep-flavoured. The plain wording is used under --no-baa, BAA_NO_BAA=1 or when CI is set, and carries exactly the same information: the code, the severity and the source span are identical either way.
Placeholders like {0} are filled in with the specifics at the point of failure.
The shape of the source is wrong. Reported before anything runs.
| Code | Severity | Default wording | Plain wording |
|---|---|---|---|
BAA001 |
error | The sheep expected a closing {0} here. | Expected a closing {0}. |
BAA002 |
error | This character isn't part of the Baa alphabet: {0} | Unexpected character: {0} |
BAA003 |
error | This string wandered off without a closing quote. | Unterminated string literal. |
BAA004 |
error | This block comment never found its way back to the pen. | Unterminated block comment. |
BAA005 |
error | This number is a bit malformed: {0} | Malformed number literal: {0} |
BAA006 |
error | The flock expected {0} here, but found {1}. | Expected {0}, found {1}. |
BAA007 |
error | This escape sequence isn't one the sheep recognise: {0} | Unknown escape sequence: {0} |
BAA008 |
error | You can only put a name on the left of =. This isn't somewhere a value can graze. |
Invalid assignment target. |
BAA009 |
error | This interpolation {{...}} is empty: there's nothing to print. |
Empty interpolation expression. |
BAA010 |
error | This statement trails off before the sheep could finish reading it. | Unexpected end of input. |
BAA011 |
error | This is nested deeper than the flock can follow: more than {0} levels. | Nesting depth exceeds the limit of {0}. |
BAA012 |
error | This block string isn't laid out the way the sheep expect. | Malformed block string literal. |
Something is not declared, is declared twice, or cannot be assigned.
| Code | Severity | Default wording | Plain wording |
|---|---|---|---|
BAA101 |
error | {0} has already been counted in this pasture. |
{0} is already declared in this scope. |
BAA102 |
error | {0} is not part of the current flock. |
Undefined name {0}. |
BAA103 |
error | {0} was shorn with const: its value can't grow back. |
Cannot assign to constant {0}. |
BAA104 |
error | return only makes sense inside a function. Out here it just echoes across the meadow. |
return outside of a function. |
BAA105 |
error | {0} only makes sense inside a loop. |
{0} outside of a loop. |
BAA106 |
error | {0} is used here before the flock has been introduced to it. |
{0} is used before it is declared. |
A function was called with the wrong number of arguments, or declared badly.
| Code | Severity | Default wording | Plain wording |
|---|---|---|---|
BAA201 |
error | {0} was called with too many sheep: it takes {1} but got {2}. |
{0} expects {1} argument(s) but received {2}. |
BAA202 |
error | {0} was called with too few sheep: it takes {1} but got {2}. |
{0} expects {1} argument(s) but received {2}. |
BAA203 |
error | This parameter name {0} is used twice in the same function. |
Duplicate parameter name {0}. |
BAA204 |
error | This parameter list doesn't line up: {0} | Invalid parameter list: {0} |
The program was valid but something went wrong while it ran.
| Code | Severity | Default wording | Plain wording |
|---|---|---|---|
BAA301 |
error | The flock wandered somewhere unexpected: {0} | Runtime error: {0} |
BAA302 |
error | You can't {0} {1} and {2}. These sheep don't herd together. | Unsupported operand types for {0}: {1} and {2}. |
BAA303 |
error | {0} isn't something you can call. Only functions answer when called. |
{0} is not callable. |
BAA304 |
error | Index {0} is outside the fence: this {1} has length {2}. | Index {0} out of range for {1} of length {2}. |
BAA305 |
error | There is no field called {1} on {0}. |
{1} is not a property of {0}. |
BAA306 |
error | Dividing by zero. Even sheep know better than that. | Division by zero. |
BAA307 |
error | The flock has been counting too deep, the stack is full. (Is a function calling itself forever?) | Maximum call depth exceeded. |
BAA308 |
error | Uncaught: {0} | Uncaught exception: {0} |
BAA309 |
error | You can't herd {0}: only arrays, maps, strings and ranges can be looped over. | Cannot iterate over {0}. |
BAA310 |
error | This key isn't in the map: {0} | Missing map key: {0} |
BAA311 |
error | {0} expected {1} for argument {2}, but got {3}. |
{0}: argument {2} must be {1}, received {3}. |
BAA312 |
error | {0} was asked to build {1} items. The pen only holds {2}. |
{0}: requested size {1} exceeds the limit of {2}. |
BAA313 |
error | That gate is bolted: this run may not {0}. | Capability denied: this run may not {0}. |
BAA314 |
error | {0} cannot use that pattern: {1}. |
{0}: unsupported pattern: {1}. |
An import, a manifest or a file could not be resolved.
| Code | Severity | Default wording | Plain wording |
|---|---|---|---|
BAA401 |
error | No module named {0} is grazing anywhere the shepherd can see. |
Module {0} could not be resolved. |
BAA402 |
error | This flock has wandered in a circle: {0} | Circular import detected: {0} |
BAA403 |
error | {0} doesn't export anything called {1}. |
Module {0} has no export named {1}. |
BAA404 |
error | Couldn't read the file: {0} | Could not read file: {0} |
BAA405 |
error | baa.toml is not well formed: {0} |
Invalid manifest: {0} |
BAA406 |
error | baa.lock no longer describes this flock: {0} |
Lockfile is out of date: {0} |
Warnings from baa lint. These never make a program invalid.
| Code | Severity | Default wording | Plain wording |
|---|---|---|---|
BAA901 |
warning | {0} is declared but never joins the flock. |
{0} is declared but never used. |
BAA902 |
warning | This code is past a return: no sheep will ever reach it. |
Unreachable code after return. |
BAA903 |
warning | {0} is imported but never used. |
{0} is imported but never used. |
BAA904 |
warning | This condition is always {0}, so the branch never really decides anything. | Condition is constantly {0}. |
BAA905 |
warning | let {0} is never reassigned: const {0} says what you mean. |
{0} is never reassigned; consider const. |
BAA906 |
warning | This empty block does nothing at all. Was something meant to graze here? | Empty block. |
Lints (BAA9xx) can be turned off per rule:
baa lint --disable BAA905 .For the unused-name lints there is a lighter option: prefix the name with _. const _deliberately_unused = 1 is never reported.
BAA3xx errors are catchable. The value bound by catch is a map with code, message, file, line and column:
try {
baa flock[99]
} catch problem {
baa "{problem.code} at line {problem.line}"
}