Error and Warning Codes

Look up a diagnostic code, find what to inspect, and check whether the error can be handled.

Find the code you saw to identify what to inspect next. Check its stage before deciding whether to use an exception handler.

Start with the code

For example, this complete expression fails during execution.

LISPEX
(car 1)

Code and message

OUTPUT
E310 · car: expected a pair, got 1

The E310 row below tells you to check the argument to car. Passing a pair, as in (car '(1 2)), returns 1. The diagnostics manual shows the full file, command, and diagnostic location.

Fix source errors before execution

Handlers have not started at these stages. Repair the source and run it again.

CodeStageWhat to inspect
E100ReaderAn invalid token or unmatched delimiter, such as the missing ) in (+ 1 2.
E110NormalizationA binding that uses a reserved word, such as if. Choose another name.
E120Reader or normalizationA forbidden extension or form, such as #; or define-syntax.
E130NormalizationA malformed form. Check its required parts, such as all three expressions in if.
E140ReaderA malformed dotted list. Check the dot and the value after it.
E150ReaderAn invalid string escape or character literal.
E314ReaderA non-finite inexact number literal, such as 1e999.

The reader turns source text into values and forms. Normalization checks form structure and rewrites shorthand into core forms.

Fix or catch runtime errors

These errors arise when execution reaches the failing operation. A guard can handle them; its selected clause returns a result from the guard expression.

CodeCauseWhat to inspect
E300Reading an unbound nameThe name at the reported source position and its definition.
E301Calling a value that is not a procedureThe value in the procedure position of the call.
E302Wrong number of argumentsThe procedure's parameters and the number of arguments supplied.
E303set! targets an unbound nameWhether the name has a binding before assignment.
E310An operation expected a pair or suitable listThe argument passed to car, cdr, or the named list procedure.
E311An index is out of rangeThe index and the size of the value being accessed.
E312A built-in procedure received the wrong typeThe types accepted by the named procedure.
E313Division by zeroThe divisor.
E314An inexact result is not finiteThe arithmetic operation and operand magnitudes.
E320Wrong number of returned values for the positionWhether the receiving expression expects one value or accepts several.
E321Reading a letrec binding before initializationReferences evaluated while its initial values are being computed.
E340An escape continuation is no longer activeWhether it has already been used or its owning call has returned.

E314 during reading cannot be caught. E314 from an arithmetic operation during execution can be caught.

An escape continuation is a procedure created by call/cc to return early from its call. It can be used only once while that call is active.

Handle raised objects and handler errors

CodeCauseHow handling works
E330(error message …) raises an error objectguard receives the object. Inspect its message and irritants, the extra values attached to the error.
E331A raised object reaches the top without being handledCatch it with guard or a handler. raise can carry any value, so check error-object? before reading error-object fields.
E332A handler returns normally from a non-continuable raiseAn outer handler can catch this new error. Use guard to leave the failing expression, or raise-continuable when a handler's return value should resume it.

If no guard clause matches and there is no else, the original raised object is raised again. raise-continuable returns the handler's result to the raising call. The errors guide shows both kinds of handling.

Update deprecated names

Warnings preserve occurrence order. Each genuine deprecated call warns once per source call site, even if the operation then fails. A binding that shadows the name does not produce that alias warning.

CodeCall that warnsUse in new code
W330%modulo
W331list-first or list-restfirst or rest, respectively

Respond to a resource limit

ResourceLimit reports a resource outcome separately from catchable E3xx errors. A non-tail call has work left to do after the called procedure returns. When the depth of these calls reaches its limit, the native command reports recursion-limit and exits with status 2.

Reduce the work or review the declared resource profile. An exception handler cannot resume a run stopped by a resource limit.

Read diagnostic locations and output channels · Handle errors