Errors & Warnings
What to do about the common ones is in Fix Language Errors.
Where an error is shown
Section titled “Where an error is shown”| Where | What it shows |
|---|---|
resonon run, resonon view console, the REPL | The full text, with the location. A parse error adds the source line and a caret. |
| VSCode Problems panel and underlines | The text without the location, underlined where it happened, with the kind’s code beside it. |
resonon check | What the editor shows, as text, without running the code. See Checking without running. |
resonon run --message-format json, resonon check --message-format json | One JSON object per line. See Machine-readable output. |
A location is path:line:column, or line:column for code that has no file. Some errors have no
location, and print their text alone.
Parse error at /home/me/song/src/main.non:1:12: expected neg, pos, not, or primary |1 | let x = 1 +; | ^resonon run exits with status 1 after an error.
When code stops
Section titled “When code stops”| Error | What runs |
|---|---|
| A parse error | Nothing of the file or selection. Every parse error in it is reported, up to 100. |
| A definition repeated in one file or selection | Nothing of it. Every repeat is reported. |
| Any other error | Everything before the statement that raised it. |
| A warning | Everything; the warning is printed as Warning: …. |
The code is what VSCode shows beside the message.
| Code | Text | Raised by |
|---|---|---|
parse | Parse error at L: … | Code that does not fit the grammar, a note literal above MIDI 127 (B9: Invalid note 'B9'), or a definition written inside a function or block. |
runtime | Runtime error at L: … | A failure with no kind of its own: a bad argument value, a failed operation. |
type | Type error at L: expected X, got Y, or the annotation’s own sentence: Type error at L: f: x expects a Number, got the String "a" | A value of the wrong type for an operator or a condition, or one that does not fit an annotation it crosses. |
conformance | Type error at L: Blob implements Shape but has no area() | A class that names an interface after implements but does not define what it asks, or defines it differently. The class is not defined. See Interfaces. |
signature_drift | Internal error: the standard library's signature and the native N disagree: … | A standard-library function and the native behind it disagree on an argument’s type. Never your code: report it. |
undefined_variable | Undefined variable 'x' at L | A name that is not defined. |
undefined_function | Undefined function 'f' at L | A call of a name that is not defined. |
undefined_type | unknown type T at L | A name in an annotation that is not a type there. The editor and resonon check report it, and running reports it when a value meets the annotation. |
undefined_method | Undefined method 'm' for type T at L | A method the value’s type does not have. |
undefined_property | Undefined property 'p' for type T at L | A field a class instance does not have. |
arity_mismatch | Arity mismatch at L: 'f' expects N arguments, got M | Too few or too many arguments. N is a number, a range min-max, or variadic. |
division_by_zero | Division by zero at L | / or % by 0. |
index_out_of_bounds | Index out of bounds at L: index I is out of range for length N | An array, tuple or string index past its end. |
assertion_failed | Assertion failed at L: message | An assert whose condition is false. Without a message: Assertion failed at L. |
borrow_error | Borrow error at L: … | A class instance changed while resonon itself still holds it. It should not happen; report it. |
private_access | Cannot access private 'x' in module 'm' at L | A private definition used from outside its module. |
module_not_found | Runtime error at L: Module 'p' not found. Searched: and each folder searched | A use path found in no search path. |
duplicate_definition | Duplicate definition at L: fn 'f' repeats the fn at L2. and a line saying what to do | A name bound twice in one file or selection — by two definitions, a let and a definition, or a use and anything else. |
dsp | DSP error at L: … | A dsp block that does not compile. See DSP Code. |
plugin_skipped | Runtime error at L: … | A plugin that the plugin scan skipped after it crashed. The editor offers to retry it. |
version_mismatch | Runtime error at L: … | Code from a project that needs a newer resonon than the server runs. The editor offers to restart the server. |
L is the location.
Warnings
Section titled “Warnings”A warning does not stop the code. resonon run prints it as Warning: …. Each warning has a code:
| Code | Raised by |
|---|---|
audio_device | An audio device that did not open, went away, or cannot do what was asked. |
preferences | A preference that is not applied, found when the session starts or by reload_preferences(). |
track_deleted | A deleted track that other tracks output to, send to or sidechain from. |
dsp_not_rebuilt | A dsp effect or instrument changed so that the instances that run it cannot take the new version. |
screen_graph | A screen graph that does not build, when no editor shows it. |
section_lane_skipped | A section lane that plays nothing, because its track is deleted or its target is not found. |
unsupported_on_effect | show_gui() or hide_gui() on a built-in DSP effect, or programs() or set_program() on an effect that is not VST3. |
external_clock_unprimed | set_midi_clock_source() while on_cycle callbacks are set. Call prime_cycles() before playback. |
midi_port_not_connected | A MIDI track routed to a port that the preferences declare, but whose device is not connected. |
render_leaves_out | A render that leaves out of master.wav a track routed to hardware outputs. |
kit_outside_project | A Kit("…") found outside the project. It does not travel with the project. |
version_mismatch | A project that targets an older resonon than the one that runs it. The code plays. |
A warning is located at the place in your code that ran when it was raised: the call that warned,
or the statement. A warning raised between two evaluations, for example by an on_cycle callback,
has no location, because the code may have changed since it ran.
Severity in the editor
Section titled “Severity in the editor”The editor checks code as you type, without running it, and runs no code to confirm what it finds.
| Found | Severity |
|---|---|
| After you evaluate: any error | Error |
As you type: parse, duplicate_definition, dsp, module_not_found, undefined_*, arity_mismatch, private_access | Error |
As you type: type, runtime, division_by_zero, index_out_of_bounds, assertion_failed, borrow_error | Warning |
Errors found as you type stay until the code changes; errors from an evaluation clear at your next evaluation.
In Live Mode (online), a
duplicate_definition between two top-level bindings in the file is not shown: each selection is
evaluated on its own.
File Mode (offline) shows
them.
Checking without running
Section titled “Checking without running”resonon check reports what the editor shows in File Mode, from the same analysis. It runs no
code and opens no audio or MIDI device. With no file, it checks the project’s src/main.non and
src/lib.non, and the modules that they import. resonon check path.non checks one file.
Each error has the severity that the editor gives it. An error found as you type is an error
line. A warning found as you type is a warning line, and its text starts with Warning:. A
Kit("…") found outside the project is a warning line with the code kit_outside_project and
the severity information.
The exit status is 0 when there is no error, and 1 when there is one or more. Warnings do not change it. A usage error exits with 2.
Editor-only diagnostics
Section titled “Editor-only diagnostics”These come from the language server, not from running code:
| Code | Severity | Where | Meaning |
|---|---|---|---|
kit-unportable | Information | .non | A Kit("…") whose kit is outside the project and not listed under [local]. |
kit-missing | Warning | resonon.toml | A [local] kits entry found nowhere. |
kit-outside-project | Information | resonon.toml | A [local] kits entry found only outside the project. |
kit-travels-anyway | Hint | resonon.toml | A [local] kits entry for a kit that travels anyway — in the project, a dependency, or the kits resonon ships — so the entry does nothing. |
manifest-unknown-key | Warning | resonon.toml | A key resonon does not read. |
manifest-syntax | Error | resonon.toml | TOML that does not parse. |
Machine-readable output
Section titled “Machine-readable output”resonon run --message-format json and resonon check --message-format json print one JSON
object per line on stdout. Each object has the
form the server sends to the editor. Its type tells what it is:
type | What it is |
|---|---|
output | Text from print(), in text. |
warning | A warning, in warning. |
error | An error, in error. |
notice | A remark about the machine or the preferences, in text. |
complete | The last line. success is false after an error. |
A warning and an error have the same fields:
| Field | What it is |
|---|---|
message | The full text, as resonon run prints it. |
error_type | The code. |
marks | Where the editor marks it. Each mark has a location (file, line, column and end), a severity, the code in error_type, and the text without the location in message. |
{"type":"error","id":"…","error":{"message":"Division by zero at /home/me/song/src/main.non:2:13","error_type":"division_by_zero","marks":[{"location":{"line":2,"column":13,"file":"/home/me/song/src/main.non","end":{"line":2,"column":14}},"severity":"error","error_type":"division_by_zero","message":"Division by zero"}]},"timestamp":"12:00:00"}{"type":"complete","id":"…","success":false,"timestamp":"12:00:00"}The exit status is the same as without the option.