Diagnostic codes

Every finding Sysprose reports about a .sysml source file carries a code from this catalogue. Codes are stable: messages get reworded, codes do not, so automation should branch on code and never on message.

This is the reference half of the Agent Diagnostics Contract; the workflow that uses it is in AGENT-AUTHORING-CAMPAIGN.md.

The shape of a finding

{
  "id": "parse#0",
  "code": "parse/mismatched-token",   // stable catalogue id — branch on this
  "severity": "error",                 // error | warning | info
  "source": "parser",                  // lexer | parser | mapper | validation | import
  "message": "Expecting token of type '}' but found `def`.",
  "range": {                           // 1-based line/column, 0-based offset
    "start": { "line": 2, "column": 10, "offset": 25 },
    "end":   { "line": 2, "column": 13, "offset": 28 }
  },
  "expected": ["}"],                   // parser errors: what would have been legal
  "found": "def",                      // what was written instead
  "hint": "Expected `}` here, found `def`. …",
  "elementId": "…",                    // validation findings: the offending element
  "elementName": "Vehicle",
  "instances": {                       // per-instance roll-up findings: the counts
    "total": 12, "generic": 1, "satisfied": 10, "violated": 1, "unknown": 0, "unread": 0,
    "listed": ["H2P::q::p"]            // "atLeast": true beside a count that is a lower bound
  },
  "instance": "H2P::q::p",             // a single-instance finding names its instance
  "relation": "H2P::P::c"              // and the relation it is about
}

range is present on every finding derived from the source text. The one family that is NOT derived from source text is checks/*: those are the app's own status rows for a check (a result, its scope, whether it could run), so they carry a code and no range. The range rule of the contract is narrowed for this family alone, because no span of the file would name the thing the row is about; see the checks source in the campaign document.

elementId and elementName appear on validation findings. expected/found appear on lexer and parser errors. instances, instance and relation appear on per-instance findings: a roll-up carries the counts in instances, and a finding about one instance names it in instance.

Severity means

Severity Meaning Does the file load?
error The file is wrong and must be fixed. Partially — error recovery keeps what it can.
warning The file loads, but something in it is unresolved or questionable. Yes.
info Something was normalised on the way in. Yes.

Lexical

The text could not be turned into tokens. Always an error; the file cannot be read as SysML until it is fixed.

lexer/illegal-char

lexer/unterminated-string

lexer/unterminated-comment

Syntactic

The tokens do not form a legal declaration. expected lists what would have been legal at that position and found is what was actually written.

parse/mismatched-token

parse/no-viable-alt

parse/early-exit

parse/not-all-input-parsed

parse/error

parse/unknown-keyword

parse/keyword-order

parse/bare-transition-arrow

parse/dangling-then

parse/conflicting-direction

Mapping

The tokens form a legal declaration, but the model this tool builds has nowhere to put it. The source text is preserved verbatim and re-emitted on save, so nothing is silently lost.

mapper/unsupported-keyword

Reference resolution

A name did not resolve. These are WARNINGS: the textual name is preserved in the model, so the file still loads, but nothing is bound to it.

ref/unresolved-type

ref/unresolved-connection-end

ref/unresolved-transition-end

ref/unresolved-specialization

ref/unresolved-reference

ref/unresolved-dependency-end

ref/unresolved-allocation-end

ref/unresolved-requirement

ref/unresolved-flow-end

ref/unresolved-alias-target

ref/unresolved-import

Model validation

The file parsed, but the model it describes breaks a rule. Each code matches a rule id in src/validation/rules.ts.

validation/unresolved-import

validation/split-declaration

validation/unknown-unit

validation/derived-dimension-mismatch

validation/connection-compatibility

validation/duplicate-name

validation/blank-name

validation/unwritable-note-body

validation/dangling-endpoint

validation/unresolved-type-ref

validation/port-direction

validation/malformed-multiplicity

validation/connector-endpoints

validation/requirement-subject

validation/redefinition-target-missing

validation/containment-cycle

validation/specialization-cycle

validation/orphan-relationship

validation/feature-typing-non-type

validation/connector-end-not-feature

validation/value-type-mismatch

validation/redefinition-conformance

validation/constraint-violation

validation/target-by-specialisation

validation/constraint-by-instance

validation/dimensional-consistency

validation/stale-evidence

Formal verification

The verification lane, and the severity splits it in two. Almost all of these are INFO because none of them is a defect in the model: they say that a relation is outside the fragment the lane encodes, that a contract has nothing to show, that a clause sits somewhere the standard does not admit it, or that a proof would be void rather than absent — each stated rather than left to be inferred from a silence. The ERRORS are the codes that say something about the MODEL — verification/refuted, the violation this lane exists to find, at their head — and the two a flag asks for: verification/vacuous-property, which exists only because --strict-vacuity asked for a vacuity to be loud, and verification/cover-required, which exists only because --cover-required asked for a decided absence to spend the 1.

verification/unsupported-expression

verification/contract-no-guarantee

verification/nonstandard-clause-location

verification/foreign-keyword

verification/keyword-names-nothing

verification/vacuous-pass

verification/not-evaluable

verification/unsupported-construct

verification/tool-absent

verification/design-admitted

verification/timeout

verification/refuted

verification/vacuous

verification/vacuous-property

verification/inconsistent-axioms

verification/inconsistent-requirements

verification/refinement-failed

verification/unconnected-assumption

verification/refinement-undecided

verification/contract-set-vacuous

verification/derivation-not-refinement

verification/single-point-of-failure

verification/optimality-not-established

verification/free-variable-unbounded

verification/claimed-without-evidence

verification/verdict-overstates-evidence

verification/method-not-performed

verification/no-property

verification/verdict-changed

verification/temporal-field-unencodable

verification/unresolved-name-in-property

verification/dimension-clash-in-property

verification/trivial-property

verification/nontriviality-unchecked

verification/unreachable-state

verification/dead-transition

verification/deadlock

verification/unrecoverable-mode

verification/completion-livelock

verification/nondeterministic-choice

verification/guard-undetermined

verification/bound-exhausted

verification/behaviour-unsupported-construct

verification/trigger-not-offered

verification/recovery-budget-withheld

verification/malformed-property

verification/unknown-atom

verification/not-covered

verification/cover-required

verification/witness-not-replayed

Input handling

Problems with the input itself rather than its content: wrong format, encoding normalisation, or a failure inside the checker.

import/not-text

import/malformed-json

import/wrong-extension

import/bom-stripped

import/crlf-normalized

import/internal-error

Round-trip

Guards against the tool producing notation it cannot read back.

roundtrip/unparseable-serialization

App checks

The palette's own status rows (src/ui/checks.ts). These are NOT derived from source text: a row is a fact about a CHECK — its result, its scope, whether it could run — so it carries a code and NO range, and the contract's range rule is narrowed for this family alone. They are catalogued here because automation reads them off the same Checks surface as every other finding and branches on the same codes; the closed set is CHECK_META_CODES, pinned to this family by test/unit/diagnostic-codes.test.ts.

checks/command-note

checks/degraded

checks/internal-error

checks/not-here

checks/not-walked

checks/pick-machine

checks/scoped

checks/whole-model


117 codes. Generated from src/text/langium/diagnostic-codes.ts.