Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Errors and exits

FormaSL errors are typed diagnostics or typed application outcomes. Do not use a substring of a text-rendered message as a programmatic contract; request JSON revision 1 or use the Rust facade when an integration needs structured fields.

First distinction: usage, rejection, driver, outcome

SituationTypical exitWhat to do
unknown verb, missing required option, invalid option value2correct the command line; no source program has been evaluated
source parses/checks/rejects1read the diagnostic code and locus, then repair the source set
source/plan cannot be read or a projection cannot be made3repair the path, encoding, permissions, or requested schema revision
selected application is unsupported4choose a supported operation or keep the boundary explicit; do not simulate a result
reasoning budget exhausted5inspect the outcome, then choose and record a larger budget if appropriate

run can also return a rejected aggregate with exit 1. An exit code is only the top-level category: inspect the output’s per-application outcome and its diagnostics before deciding how to recover.

Diagnostic classes

The facade classifies diagnostics as:

  • normative_rejection — a source/program invariant was violated;
  • product_binding — an input set, import, or product-level binding is incoherent;
  • driver — input/output, command, or external driver boundary failure;
  • internal — an implementation invariant failure that should be reported with a minimal reproducer.

Common codes include:

CodeMeaningRecovery
UNEXPECTED_TOKENlexer or parser could not admit the token in that positionstart from a small accepted module; check quotes, braces, commas, and reserved words
MALFORMED_RANGEa bounded range has its lower bound above its upper bounduse an ordered range such as 0..1 or an open upper bound such as 0..*
INVALID_UNBOUNDED_PATH_FORMATIONa path body declares an unbounded repeat (for example repeat 1..*)give the path a finite upper bound so the route is checkable
UNRESOLVED_REFERENCEa name did not resolve in the current checked source setdeclare it earlier, use a valid import, and pass every imported .fsl input
AGGREGATE_GROUP_CORRELATION_REQUIREDa rule-aggregate by ?key compatibility shorthand has zero DISTINCT exact-source candidate roles over the whole semantic ruleauthor the explicit correlation (by Source.role as ?key or by Source.role); a binder bound only by a different relation is not a source candidate
AMBIGUOUS_AGGREGATE_GROUP_CORRELATIONthe shorthand by ?key is positively bound by more than one DISTINCT role of the exact aggregate sourceauthor by Source.role as ?key per intended component; correlation is never decided by spelling, order, type, or first match
AGGREGATE_GROUP_BINDER_COLLISIONa MemberDerived output binder is introduced by more than one component, or collides with the aggregate result binderuse distinct output binders (as ?v), distinct from the aggregate’s result variable
IMPORT_CYCLEprovided modules form an import cyclebreak the cycle; imports must be acyclic
DUPLICATE_SOURCE_REFERENCEtwo SourceInput values use the same referencegive each supplied source a unique reference
DUPLICATE_MODULE_NAMEtwo inputs declare the same module namegive modules distinct names or pass only the intended revision
EMPTY_SOURCE_SETthe facade was called without source inputssupply at least one complete module
UNKNOWN_APPLICATION--app or a facade selection names no checked applicationuse inspect --view applications and select the exact name
RULE_WIRE_REJECTIONa rule’s using target resolves to a declaration kind with no defined rule-basis semantics (only theory/ontology authority and relation/content dependency coordinates are admissible)re-point the rule at a theory, ontology, relation, or content basis; the source may parse, but it is not executable on the public reasoning path
PROJECT_MODE_CONFLICTexplicit .fsl operands were combined with project flags, or a project-only flag was supplied to a command that rejects itchoose one mode: either explicit file operands or project flags, never both
PORTABLE_PATH_INVALIDa package source-rebind/source-new --path value violates the portable-path grammaruse a package-relative path per the frozen release-contract grammar
DRIVER_IOthe CLI cannot read an input pathcorrect the path or file permissions; keep .fsl and .fsp inputs explicit

The parser’s source locus identifies the actual source span. Preserve it with a reproducer rather than replacing a rejected source with a dummy default.

Current surface-shape recovery

Several UNEXPECTED_TOKEN diagnostics are best repaired by checking the actual header shape, rather than changing names at random:

IntentImplemented spellingFrequent non-working sketch
selective module importimport Q { Name as Local }import Q::{Name} or import Q::*
import a claimimport claim Q as local_claimclaim import Q …
constraint parametersconstraint Name using Basis($x: Type) { … }constraint Name($x: Type) using Basis { … }
revision applicationrevise Name($x: Type) using Basis { … }adding from $base to revise
source evolutionevolve source Name(…) using Basis from $base { by: $editor … }omitting the required by: header
realization bindingbind capability to external "reference"using $variable, ?witness, or a .fsl pure call as a realization value

For a source import failure, pass the full import closure as explicit .fsl operands. For a realization failure, retain exactly one .fsp --for plan and check that every target it names exists in the checked program. See the Language guide for the broader surface reference.

Intentional command-line failures

run has no hidden gas default:

formasl run examples/hello.fsl

realize has no hidden plan default:

formasl realize examples/hello.fsl

Both are command-line usage failures (exit 2). The recovery is to add the required --gas N or exactly one --for PLAN.fsp; do not reinterpret a missing argument as an empty resource budget or empty realization.

Machine-output failures

A JSON projection can fail closed when a frozen schema revision cannot represent the observed run result. Use --schema-revision 1 for a new machine consumer. That is not a conversion of the underlying semantic result; it selects the current successor representation.

Reporting a defect

When a result looks inconsistent, report:

  1. the exact CLI command or facade request;
  2. every supplied .fsl and .fsp source (or a minimal redacted reproducer);
  3. the exit status, diagnostic codes, and requested schema revision;
  4. whether a realization plan was supplied; and
  5. the expected typed outcome versus the actual one.

This separates an invalid command, rejected input, finite gas budget, and an implementation defect without guessing from prose alone. See Toolchain and CLI for the complete exit table.