Skip to content

Compiler diagnostics

Prismio 0.1 error rendering, recovery, warnings and notes, source spans, and the permanent codes the driver and project commands report.

Last verified

Prismio diagnostics include the source path, line, column, source excerpt, and a primary message. The frontend can recover from selected lexer/parser/semantic failures and report multiple independent errors in one invocation. Notes and warnings provide secondary context where available.

Diagnostic stages

A failure can originate in:

  • source loading or import resolution;
  • lexical tokenization;
  • parsing and recovery;
  • name, type, control-flow, or ownership analysis;
  • AIF constraint analysis;
  • LLVM IR generation/verification; or
  • object generation and native linking.

The first useful correction is normally at the earliest failing stage. A parser recovery diagnostic can cause later names to be missing, so fix syntax errors before treating every follow-up message as an independent type defect.

Source spans

Paths and positions identify the source that contributed the failing declaration after import resolution. A primary span points to the token/expression most directly responsible; notes may identify an earlier declaration, move, or candidate signature.

Column interpretation follows the compiler's current source accounting and should not be parsed as a byte-offset protocol by external tools without a versioned integration contract.

The compiler exits nonzero when compilation fails and does not emit a runnable artifact as though the program were valid.

When selected recovery succeeds, multiple diagnostics can appear. This does not mean later phases run on a program accepted as valid; it is error recovery for developer feedback.

Every diagnostic carries a code in brackets, such as error[P4001] or warning[P1077]. Codes are not stable in 0.1: one can be renumbered, split, or removed before 1.0, so do not depend on a specific value. Most semantic errors share P4001, so a code names the stage that reported the problem and the message names the rule. The permanent identifiers used in this documentation, such as use-after-move, are URL keys for a specific rule. Each error page records the message fragment used by the audited tests, so match on that as well as the code.

Reading a diagnostic

  1. Locate the first primary error in the earliest source stage.
  2. Read any note that points to the declaration, earlier move, or overload candidates.
  3. Compare the operation's exact type and ownership mode.
  4. Apply the smallest correction rather than casting, cloning through FFI, or adding annotations speculatively.
  5. Recompile to reveal independent errors hidden by the first failure.

For ownership messages, distinguish mutability from ownership: mut enables assignment but does not revive moved data. For overload/type errors, remember that numeric widening is explicit. For optional errors, comparison with none does not flow-narrow; use expect where presence is established.

Warnings and notes

A warning does not make compilation fail unless the driver documents otherwise. A note supplies context and is not independently actionable. 0.1 does not promise a stable warning-control flag set or warning-as-error policy.

When reporting a diagnostic bug, include the compiler version, full command, smallest source file that reproduces it, target platform, and complete output. Do not rely on color escape sequences or exact whitespace as a public API.

Also include imported reproducer files when name resolution matters, and emitted .ll when the failure occurs after semantic analysis. Remove secrets and machine-specific paths where possible while preserving the relevant directory layout.

The error reference is organized by permanent concepts, so pages stay linkable while diagnostic wording improves. The codes the driver and the project commands print are listed below.

Codes

A code is P and four digits, and the leading digits say which stage reported it.

RangeReported by
P10xxthe driver and the project commands: reading sources, resolving imports, building, running, prismio init, the project's own compiler. Listed in full below
P2001the lexer
P30xx–P33xxthe parser
P4001, P4002, P41xxsemantic analysis; P41xx is ownership and foreign functions
P50xxAIF, the Adaptive Inference Framework
UMS####the manifest: build.ums itself, printed as build.ums:11:20: error[UMS2324]: .... See the build manifest reference

The compiler contributor documentation explains where each range is produced.

Driver and project codes (P10xx)

These are the errors a command reports before or after the compiler proper: a missing file, a flag the command does not take, a project that cannot be built. The problem is usually in what you typed or in build.ums, and the note under the error often names the fix. For example:

bash
prismio run --verbose
text
error[P1019]: unknown argument `--verbose`
  note: arguments for the program go after `--`: `prismio run -- --verbose`
bash
prismio build nope
text
error[P1080]: this project declares no target named `nope`
  note: declared targets: checksum

A program's own exit status is never one of these. prismio run exits with the status the program returned, and prints nothing extra when that status is non-zero. Only a failure of the toolchain itself gets a P code.

The tables give each code's severity, the message it prints (with x standing for the name or path it fills in), and what to do. A warning does not stop the command. Codes P1009, P1035, P1038, P1057, P1060, P1063 and P1074 are not issued today, and a code is not reused, so the gaps stay gaps.

Reading source files and imports

CodeMessageWhat to do
P1001errorcannot read imported module x: no such file ...An import names a file that is not there. Imports are rooted at the entry file's directory and use dots for directories; see modules and imports
P1002errorpackage x contains no modulesA wildcard import names a directory with no .psm files
P1005errorcannot read pathprismio check was given a file that does not exist or cannot be read
P1008errorcannot read pathprismio build or run was given a file that does not exist or cannot be read
P1068errorcompiled standard-library module x is missing, incompatible, or corruptedThe installed standard library does not match this compiler. Reinstall Prismio; the message ends with the reason
P1069errorthe name x is already bound to y in this fileA file may bind each as name once. Choose a different alias
P1070erroras names a module, and x is not oneas renames a whole module. Drop it from a selective import, or alias the module the declaration comes from
P1071errorx is already the name of a module, so it cannot also be an aliasx.f(y) would mean two things. Pick an alias no module in the project has
P1072erroran import group names modules, and x is a declaration inside yA { ... } group lists modules. Import a single declaration with its own import y.x
P1094errorstd.x cannot be imported by a --freestanding programThe module needs an operating system or a C library: std.io, std.display, std.input, std.fs, std.process, std.time, std.term or std.math. The rest of std is available; see Freestanding programs

Building and running one file

CodeMessageWhat to do
P1003warning--force-layout did not applyNo candidate of that type keeps that many fields hot. prismio aif --layout lists the candidates
P1004errorthe installed Prismio runtime library is staleThe runtime library was built from different sources than the ones on disk, and the message prints both hashes. Re-package the toolchain with tools/package.py, or build from outside the source tree to use the installed runtime as it is
P1006warningthis module declares more than one workloadOnly the first workload is measured; the profiles are not merged
P1007warningthe reason a workload did not produce a profile: it failed to build, exited with a failure status, timed out after 60 seconds, or wrote no profileThe build continues with the static profile. When the workload failed to build, the message names the kept driver IR
P1010errorcannot write LLVM IR to pathThe output path is not writable. Check the directory and its permissions
P1011errorthe native build step failed (llc/clang)The compiler or linker failed, and its own output is printed above this line. An undefined symbol means an object never reached the link; see Calling C from Prismio
P1012errorcould not start pathThe program was built but the operating system would not start it. A program that starts and returns non-zero is not this error
P1075warningx is not part of the program y, so it was not checkedprismio check --overlay named a file the program never reads. An editor tries the next program that might

Command-line arguments

CodeMessageWhat to do
P1024errorcannot find the Prismio runtime sources to hashprismio runtime-hash reads the runtime sources of a compiler checkout, and found none
P1025errormissing source fileprismio check needs a file
P1026errorunknown argument xprismio check takes --diagnostic-format=json, --overlay and --module
P1027errormissing source fileprismio dump-ast needs a file
P1028errormissing source fileprismio aif needs a file
P1090error--link-arg, --native, --native-flag, --target-features or --code-model requires a valueEach of the five takes the argument after it
P1091errorcould not record the linker argument x--link-arg ran out of memory storing it
P1092errorthe target feature string is too long, or this compiler has no code generation--target-features takes at most 511 characters, and needs a compiler built with LLVM's C headers
P1093errorunknown code model x--code-model takes small, kernel, medium or large
P1095errorcould not record the native source x--native ran out of memory storing it
P1096errorcould not record the native flag x--native-flag ran out of memory storing it
P1029error--force-layout= takes <Type>:<hot-field-count>Write it as --force-layout=Particle:8
P1030error--budget= must be at least 1 roundGive a positive round count
P1031error--target requires an LLVM target tripleprismio aif --target needs one, for example wasm32-unknown-unknown
P1032errorunknown target triple xLLVM does not know that triple. Check the spelling
P1033errorunknown argument xprismio aif does not take it. prismio --help-all lists the flags
P1040error-o requires an output pathFollow -o with a path
P1041errorunknown optimization level xUse -O0 to -O3
P1042error--target requires an LLVM target tripleFollow --target with one, for example x86_64-apple-macos
P1043errorunknown target triple xLLVM does not know that triple
P1044error--jit and --target cannot be combinedThe JIT runs the module inside this process, so it can only target the host
P1045error--sysroot requires a path to the target's SDKFollow --sysroot with the SDK directory
P1046error--jit is only meaningful with prismio runbuild produces an object; there is nothing to run in this process
P1047error--jit and --target cannot be combinedAs P1044, reported when the target was chosen another way
P1048error--force-layout= takes <Type>:<hot-field-count>As P1029, for build and run
P1049erroruse either build or run, not bothName one verb
P1050errorunknown argument xbuild and run do not take it. For run, the note shows that the program's own arguments go after --
P1079error-- passes arguments to the program run starts, and build starts noneUse -- only with run
P1039errorunknown command xNot a built-in and not declared in build.ums. The note lists the built-ins, and the project's own commands follow

Creating a project

CodeMessageWhat to do
P1013errorcannot use x as a project nameA name starts with a letter, a digit or _, and holds those plus - and .. Run prismio init <name>
P1014errorpath already existsinit never overwrites a manifest
P1015errorcould not create path/srcCheck that the directory is writable
P1016errorcould not write path/build.umsCheck that the directory is writable
P1017errorcould not write path/src/main.psmCheck that the directory is writable
P1018errorcould not write path/.gitignoreCheck that the directory is writable
P1036errorinit takes at most one namePass one name, or none to use the directory's

Project commands

These come from prismio build, run, test, clean and the commands a manifest declares.

CodeMessageWhat to do
P1019errorunknown argument xA project command takes --release and target names. For run, program arguments go after --
P1020errorcould not remove everything under pathclean could not delete the profile directory. Something inside may be open or read-only
P1021errorthis project declares no executable target to runAdd an executable("name") { entry = "src/main.psm" } to the manifest
P1022errorthis project declares more than one executable targetName the one to run: prismio run <target>
P1023errorcould not start pathThe executable was built but could not be started. Not the program's exit status
P1037errorclean acts on the project and takes no source fileRun prismio clean from the project
P1058errorcould not prepare native linker inputsA link or native entry could not be handed to the linker. The manifest checks (UMS23xx) catch most causes earlier
P1059errorproject command x failed at step N (step), exit status SThe step's program returned S, and that is the command's exit status. Its own output is above
P1061errora command step cannot build the toolchain.host targetRun prismio build first; the rebuilt compiler is promoted only after that process exits
P1062errora project command cannot be named xThe name is a built-in and built-ins win. Rename the command in build.ums
P1078errorthis project needs Prismio X, and this compiler is YThe manifest's prismio is newer than the compiler. Install a newer Prismio, or lower it
P1080errorthis project declares no target named xThe note lists the declared targets
P1081warningdependencies are resolved and locked, but Prismio 0.1 does not import from them yetVendor the source beneath your entry module and import it by its dotted path
P1082errorcould not write prismio.lockThe manifest's directory is not writable
P1084error-- passes arguments to the program run starts, and x starts noneUse -- only with run
P1085errorclean acts on the whole profile and takes no targetRun prismio clean alone
P1086errorx is not an executable targetrun needs an executable, not a test or library
P1087errorrun runs one target, and was given twoProgram arguments go after --
P1088errorx is not a test targetprismio test takes test(...) targets
P1089errorcould not create path/toolsThe profile directory is not writable; .psm tools build there

The project's own compiler

A project can build its own compiler and have prismio use it; see a project's own compiler. These codes are about that compiler.

CodeMessageWhat to do
P1034errorprismio bootstrap has been removedBuild the compiler from its checkout with prismio build; its build.ums names the C sources. With no compiler at all, tools/bootstrap.sh --seed builds one from the release seed it fetches
P1051errorthe project-local compiler cannot replace itself without its global parentRun prismio build through the installed compiler, not through the project's own
P1052warningthe configured project host is not runnableThe file at toolchain.host will not start, so the global compiler serves the command. Rebuild it with prismio build
P1053errorthe compiler candidate did not build; the active local compiler was keptThe new compiler failed to build. The previous one still works
P1054errorthe compiler candidate did not start; the active local compiler was keptThe new compiler linked but would not run. The previous one still works
P1055errorcould not promote the compiler candidateThe new compiler could not replace the active one. The active one was kept
P1056errorcould not remove the project compiler after cleanDelete the file by hand
P1064warningthe project compiler is from an older toolchain generationIt is being rebuilt with the global compiler first
P1065warningno target in this project builds the configured compiler hosttoolchain.host names a path no target produces. The global compiler serves the command
P1066errorthe rebuilt project compiler reports a different generationThe installed compiler is older than the project's sources. Build a newer one from the checkout
P1067errorthe project compiler was built without its runtime and standard libraryIt can build itself and nothing else until this succeeds
P1077warningthe project compiler was not built on this machine, so it will not be runA compiler a cloned repository brought with it is never run. prismio build builds it here; until then the global compiler serves the project
P1083warningcould not record the promoted compiler as built on this machineThe compiler was promoted but will not be run until a later prismio build records it

When a command prints machine output (--diagnostic-format=json or --manifest), P1077 is left out, so an editor's check sees only diagnostics about the file.