8. Validation and Diagnostics
Diagnostics in Culsma are stage-placed:
- each stage emits the failures it can decide earliest
- diagnostic prefixes (
LOAD/LIB,SEM,TYPE,ENTRY,PLAN,RT,MAT) mark that stage placement - the diagnostic code set and stage boundary do not imply a single monolithic diagnostic subsystem
8.1 Validation Stages
Culsma uses staged checks:
- Entry-source and definition-dependency loading
- Library-definition resolution
- Compilation to a normalized intermediate representation
- Semantic validation
- Type/unit validation
- Entry resolution
- Execution-plan construction
- Runtime execution
Pipeline order:
- The standard pipeline order is load -> resolve -> compile -> validate -> typecheck -> entry -> plan -> runtime.
- Compilation produces Canonical IR plus semantic-analysis input; semantic validation consumes both.
- Execution-plan construction may emit
PLAN_*diagnostics while still producing an execution plan; runtime execution consumes plan diagnostics according to the runtime error policy. - Runtime material compute, observation recording, and protocol-output capture are part of runtime execution, not separate pre-runtime stages.
8.2 Operation Contract Check Placement
Operation vocabulary definitions and call contracts are specified in Chapter 6.
Call validation applies equally to statements and nested expressions. A constructor in a load item or an expression reached through an alias is subject to the same parameter-name rules as an ordinary call.
- Step-call syntax accepts
IDENTIFIER(...), but semantic validity requires operation presence in the vocabulary; unknown names produceSEM_UNKNOWN_STEP. - Missing required arguments, unknown arguments, and duplicate argument names are semantic failures. Unknown names produce
SEM_UNKNOWN_ARG; duplicates produceSEM_DUPLICATE_ARGbefore any value can overwrite another. - Container/content source forms follow the constructor contracts in Chapter 6. Missing content kind and missing or malformed content type retain their content-specific diagnostics in §8.2.2.
- Open
attrskeys are metadata, not additional top-level parameters. For example,attrs = { role: culture }is permitted; top-levelrole = cultureproducesSEM_UNKNOWN_ARG.
Diagnostic identity follows source origin. Repeated analysis or expansion of one source occurrence MUST report an identical semantic diagnostic only once. Code, message, and severity must all match for this purpose. Distinct source occurrences remain distinct even when their line and column coordinates match in separate files. Diagnostics that describe different bound values also remain distinct. When common origin cannot be established, diagnostics MUST NOT be merged solely because their coordinates or messages match.
8.2.1 Canonical Content Whitelist
content_kind and standard content_type values are constrained by the canonical whitelist defined in Chapter 6.
Validation policy:
- Missing
content_kindis semantic error. - Non-whitelisted
content_kindis semantic error in strict mode. content_typeuses lowercase snake_case tokens.- Standard
content_typevalues should use canonical tokens. - The canonical
content_typesurface is closed; uncommon material identities should use the Chapter 6other_*fallback for theirkind. - Standard
attrs.rolevalues are recommended/controlled by Chapter 6, butattrsremains open metadata; unknown attr keys are not rejected solely for being unknown.
Validation contract:
- The whitelist is part of the content contract.
- Dedicated content diagnostics below are part of the staged diagnostic contract.
- Legacy content kind/type aliases, including older custom/unknown type strings, are compatibility inputs only when legacy normalization mode is explicitly enabled. Such inputs should produce warning diagnostics and normalize to Chapter 6 canonical values.
Enum-family errors remain type diagnostics; member/cycle errors remain semantic errors. Planning/runtime checks apply once final values are known and do not replace earlier diagnostics. Valid explicit enums are executable. Rejected final classifications do not modify material state.
8.2.2 Diagnostic Mapping Table (Content + Mutation Model)
| Failure condition | Earliest stage | Diagnostic code | Status |
|---|---|---|---|
| missing content kind in a content constructor | semantic | SEM_MISSING_CONTENT_KIND | current |
| unknown explicit content/container enum member | semantic | SEM_CONTENT_ENUM_MEMBER_INVALID | current |
| cyclic content binding | semantic | SEM_CONTENT_ENUM_BINDING_CYCLE | current |
| content/container argument uses the wrong enum family | type | TYPE_CONTENT_ENUM_TYPE_MISMATCH | current |
| non-text and non-enum container kind | type | TYPE_CONTAINER_KIND_NOT_TEXT | current |
| final statically bound content classification is invalid | plan | PLAN_CONTENT_CLASSIFICATION_INVALID | current |
| final statically bound container kind or surface capacity is invalid | plan | PLAN_CONTAINER_KIND_INVALID | current |
| final runtime content classification is missing, nontext, wrong-family or invalid | material | MAT_CONTENT_CLASSIFICATION_INVALID | current |
| final runtime container kind is invalid | material | MAT_CONTAINER_KIND_INVALID | current |
| invalid container capacity, including surface volume capacity | material | MAT_INVALID_CAPACITY | current |
non-whitelisted content_kind (strict mode) | semantic | SEM_INVALID_CONTENT_KIND | current |
invalid content_type normalization (required mode) | semantic | SEM_INVALID_CONTENT_TYPE_FORMAT | current |
unsupported content_type token in strict canonical mode | semantic | SEM_INVALID_CONTENT_TYPE_VALUE | current |
legacy or unknown content taxonomy normalized to canonical value or other_* in compatibility mode | semantic | SEM_CONTENT_TAXONOMY_COMPAT_NORMALIZED | current warning |
unsupported constructor container kind | semantic | SEM_INVALID_CONTAINER_KIND | current |
surface(...) constructor provides volume capacity | semantic | SEM_SURFACE_CAPACITY_FORBIDDEN | current |
constructor load = [...] item is not a valid content_spec:quantity pair list | semantic | SEM_INVALID_LOAD_ITEM | current |
invalid container target-view member path such as container.structure, container.structure.upper, or container.structure.top.inner | semantic | SEM_CONTAINER_TARGET_VIEW_INVALID | current |
non-text content_kind | type | TYPE_CONTENT_KIND_NOT_TEXT | current |
non-text content_type | type | TYPE_CONTENT_TYPE_NOT_TEXT | current |
non-text content_code | type | TYPE_CONTENT_CODE_NOT_TEXT | current |
non-record attrs | type | TYPE_CONTENT_ATTRS_NOT_RECORD | current |
ContainerTargetView is used where a material Container is required | type | TYPE_CONTAINER_TARGET_VIEW_POSITION_INVALID | current |
mutation statement uses legacy per-source program(...) payload shape | semantic | SEM_MUTATION_PROGRAM_SOURCE_SHAPE_CONFLICT | current |
source.partition(program)[i] is used outside mutation source position | semantic | SEM_SOURCE_PARTITION_CONTEXT_INVALID | current |
source.partition(program)[i] program does not resolve to a partition-capable concrete program | semantic | SEM_PROGRAM_OWNER_MISMATCH / SEM_PROGRAM_KIND_INVALID | current |
source.partition(program)[i] index is missing, non-static, negative, or outside binary range | semantic | SEM_INDEX_NOT_STATIC_INTEGER / SEM_INDEX_NOT_NONNEGATIVE_INTEGER / SEM_INDEX_OUT_OF_RANGE | current |
container.contents[i] is used outside mutation source position | semantic | SEM_CONTAINER_CONTENTS_INDEX_CONTEXT_INVALID | current |
container.contents[i] index is missing, non-static, or negative | semantic | SEM_INDEX_NOT_STATIC_INTEGER / SEM_INDEX_NOT_NONNEGATIVE_INTEGER | current |
| standalone content init appears in execution flow | semantic | SEM_STANDALONE_CONTENT_INIT_FORBIDDEN | current |
| unknown content identity at load/apply | material | MAT_CONTENT_NOT_FOUND | current |
| incompatible amount axis in content loading | material | MAT_CONTENT_LOAD_AXIS_MISMATCH | current |
| immutable content metadata conflict | material | MAT_CONTENT_METADATA_CONFLICT | current |
selected scientific provider is absent, not applicable, or returns UNRESOLVED | material | MAT_SCIENTIFIC_MODEL_UNRESOLVED | current |
| selected scientific provider fails | material | MAT_SCIENTIFIC_MODEL_FAILED | current |
| selected scientific provider returns an invalid proposal | material | MAT_SCIENTIFIC_MODEL_PROPOSAL_INVALID | current |
sep.component_fates is not a nested record, omits an output, uses an unknown output name, contains an invalid ratio, or does not sum to 100% | semantic | SEM_SEPARATION_FATE_RULE_SHAPE_INVALID / SEM_SEPARATION_FATE_RULE_SLOT_INVALID / SEM_SEPARATION_FATE_RULE_VALUE_INVALID / SEM_SEPARATION_FATE_RULE_TOTAL_INVALID | current |
sep.component_fates references content absent from the runtime source | material | MAT_SEPARATION_FATE_COMPONENT_NOT_FOUND | current |
sep.transitions is not a list of typed transition(...) values, uses an invalid selector, uses a bare/cross-program/unknown output member, supplies a string, bare, unknown, or internal target state, or supplies an invalid association selector | semantic | SEM_MATERIAL_TRANSITIONS_SHAPE_INVALID / SEM_MATERIAL_TRANSITION_* / SEM_MATERIAL_SELECTOR_* | current |
sep.transitions target is outside the author-settable MaterialRelation enum, a selected index or exact entry ID is unavailable, the selected output has zero quantity, or a component-bound association target is missing from that output | material | MAT_MATERIAL_TRANSITION_* / MAT_MATERIAL_INDEX_OUT_OF_RANGE / MAT_MATERIAL_ENTRY_ID_NOT_FOUND / MAT_MATERIAL_RELATION_INVALID | current |
container.contents[i] is read without a current valid indexed contents state | material | MAT_CONTENTS_STATE_NOT_INDEXED | current |
container.contents[i] index does not exist in the current contents state | material | MAT_CONTENTS_STATE_INDEX_OUT_OF_RANGE | current |
container.contents[i] reads a preserved indexed contents state outside its required preservation context | material | MAT_CONTENTS_STATE_PRESERVATION_NOT_SATISFIED | current |
8.2.3 Diagnostic Mapping Table (Atomic Statements + Readout)
| Failure condition | Earliest stage | Diagnostic code | Status |
|---|---|---|---|
| External vocabulary field contains a member from another domain, or an invalid value shape for that field | typecheck | TYPE_EXTERNAL_ENUM_MISMATCH | current |
stream.unit, data_ref.kind, data_group_ref.kind, or a typed attrs.role/state/bead_property expression names an unknown member or uninstalled namespace | semantic | SEM_INVALID_EXTERNAL_PARAMETER | current |
| External vocabulary value or dependent parameter combination becomes invalid after protocol argument binding | plan | PLAN_EXTERNAL_ENUM_INVALID | current |
| Deferred external vocabulary, stored extension identity, or dependent parameter contract fails final validation before execution | runtime | RT_EXTERNAL_ENUM_INVALID | current |
with env(...) inferred/explicit-hold target missing | semantic | SEM_ENV_TARGET_REQUIRED | current |
with env(...) missing body and explicit hold form | semantic | SEM_ENV_BODY_REQUIRED | current |
with env(...) missing every supported environment dimension | semantic | SEM_ENV_THERMAL_REQUIRED | current |
scalar with env(thermal = ..., ...) missing required duration for pure hold/incubation or env-bound time scheduling | semantic | SEM_ENV_DURATION_REQUIRED | current |
with env(duration=...) without thermal | semantic | SEM_ENV_DURATION_WITHOUT_THERMAL | current |
outer duration is used together with thermal_program(...) | semantic | SEM_ENV_DURATION_FORBIDDEN_WITH_THERMAL_PROGRAM | current |
with env(...) uses thermal-only modifier outside thermal scope | semantic | SEM_ENV_ARG_CONFLICT | current |
hold(...) appears outside a direct with env(...) body, including inside a nested non-env sub-block | source/compile | hard error | current |
hold(...) has zero args, multiple args, or an unsupported argument shape | source/compile | hard error | current |
hold(...) target is not a valid env target shape | source/compile | hard error | current |
legacy hold(sample = ...) compatibility spelling is accepted | source compatibility | no diagnostic | current |
agit(...) uses unsupported mode | semantic | SEM_AGIT_MODE_UNKNOWN | current |
agit(mode=shake) uses unsupported motion | semantic | SEM_AGIT_MOTION_UNKNOWN | current |
agit(...) uses a mode/target or mode/argument combination not allowed by its contract | semantic | SEM_AGIT_ARG_CONFLICT | current |
agit(mode=CENTRIFUGE) omits its centrifugal drive | semantic | SEM_MISSING_REQUIRED_ARG | current |
agit omits required action duration or the duration/count choice for rocking | semantic | SEM_AGIT_DURATION_REQUIRED | current |
| A statically resolved explicit-motion or legacy rotation parameter violates its quantity contract | semantic | SEM_AGIT_QUANTITY_INVALID | current |
attached program = ... does not resolve to a concrete *_program(...) call | semantic | SEM_PROGRAM_KIND_INVALID | current |
legacy generic program(...) form is used | semantic | SEM_LEGACY_PROGRAM_FORM_FORBIDDEN | current |
concrete *_program(...) kind is not valid for the owning operator family | semantic | SEM_PROGRAM_OWNER_MISMATCH | current |
concrete *_program(...) enum field uses unsupported token | semantic | SEM_INVALID_PROGRAM_ARG_VALUE | current |
| mutually exclusive program fields are supplied together | semantic | SEM_PROGRAM_ARG_CONFLICT | current |
field_program.field is used instead of field_program.voltage | semantic | SEM_FIELD_PROGRAM_FIELD_ALIAS | current |
with constraint(...) missing body | semantic | SEM_CONSTRAINT_BODY_REQUIRED | current |
with constraint(...) provides neither requirement nor option | semantic | SEM_CONSTRAINT_ITEM_REQUIRED | current |
with constraint(...) names an unknown bare requirement or qualified member | semantic | SEM_UNKNOWN_REQUIREMENT | current |
| Requirement extension identity is unknown, inconsistent, or unsupported by the executor | runtime | RT_DRIVER_REQUIREMENT_UNSUPPORTED | current |
spread transfer target resolves to a non-surface | semantic | SEM_SPREAD_TARGET_NOT_SURFACE | current |
with constraint(...) duplicates an option key | semantic | SEM_CONSTRAINT_DUPLICATE_OPTION | current |
| requirement is not valid for block scope | semantic | SEM_CONSTRAINT_SCOPE_INVALID | current |
customized is mixed with standard requirements | semantic | SEM_CONSTRAINT_CUSTOMIZED_EXCLUSIVE | current |
constraint(customized, ...) omits schema_ref | semantic | SEM_CONSTRAINT_CUSTOMIZED_SCHEMA_REQUIRED | current |
| unsupported constraint option is supplied | semantic | SEM_CONSTRAINT_UNKNOWN_OPTION | current |
| active requirement does not allow the action family | semantic | SEM_CONSTRAINT_ACTION_FAMILY_MISMATCH | current |
active cold_chain requirement conflicts with env thermal setting | semantic | SEM_CONSTRAINT_ENV_CONFLICT | current |
| Bound cold-chain thermal setting exceeds its limit | runtime | RT_CONSTRAINT_ENV_CONFLICT | current |
| Active requirements are unknown, inapplicable, conflicting, or require an unresolved explicit thermal value | runtime | RT_CONSTRAINT_INVALID | current |
| statement-level quantity field uses a globally invalid/unknown unit form | type | TYPE_DIMENSION_MISMATCH / TYPE_UNKNOWN_UNIT / TYPE_UNIT_NOT_ALLOWED | current |
| program field quantity/dimension mismatch | type | TYPE_PROGRAM_FIELD_KIND_MISMATCH / TYPE_PROGRAM_FIELD_DIMENSION_MISMATCH | current |
8.3 Semantic Diagnostics (SEM_*)
Primary semantic diagnostics:
These codes cover statement legality, argument shape, binding legality, requirement compatibility, and operator-family membership:
SEM_UNKNOWN_STEP: step/operator name is not in the semantic vocabularySEM_MISSING_REQUIRED_ARG: a required argument is missingSEM_UNKNOWN_ARG: an argument name is not allowed for the callSEM_DUPLICATE_ARG: the same argument name appears more than onceSEM_UNBOUND_NAME_REFERENCE: a referenced local/runtime-visible name is not bound in scopeSEM_MISSING_CONTENT_KIND: content declaration omits required kindSEM_INVALID_CONTENT_KIND: content kind is outside the whitelistSEM_INVALID_CONTENT_TYPE_FORMAT: content type token shape is invalidSEM_INVALID_CONTENT_TYPE_VALUE: content type token is not allowed for the selected kindSEM_INVALID_CONTAINER_KIND: constructor uses an unsupported container kindSEM_SURFACE_CAPACITY_FORBIDDEN:surface(...)uses forbidden volume capacitySEM_INVALID_LOAD_ITEM: constructorload=[...]item shape is invalidSEM_STANDALONE_CONTENT_INIT_FORBIDDEN: execution flow contains standalone content-init material formsSEM_MUTATION_PROGRAM_SOURCE_SHAPE_CONFLICT: mutation-attached program shape is invalid for the source styleSEM_ENV_TARGET_REQUIRED:with env(...)has no inferred or explicit targetSEM_ENV_BODY_REQUIRED:with env(...)has neither body nor explicit hold formSEM_ENV_THERMAL_REQUIRED:with env(...)provides no supported environment dimensionSEM_ENV_DURATION_REQUIRED: scalar thermal env is missing an explicit duration where the block is a pure hold/incubation or otherwise requires an enclosing time boundarySEM_ENV_DURATION_WITHOUT_THERMAL: duration appears without thermalSEM_ENV_DURATION_FORBIDDEN_WITH_THERMAL_PROGRAM: outer duration is used withthermal_program(...)SEM_ENV_ARG_CONFLICT: env arguments conflict with the selected env modeSEM_CONTAINER_TARGET_VIEW_INVALID: container target-view member path is incomplete or outside the closed accessor setSEM_AGIT_MODE_UNKNOWN:agit(...)mode is unsupportedSEM_AGIT_ARG_CONFLICT:agit(...)target or argument combination is invalid for the selected mode; deferred combinations retain runtime ownership (RT_EXTERNAL_ENUM_INVALID)SEM_PROGRAM_KIND_INVALID: attached program does not resolve to a known concrete*_program(...)SEM_LEGACY_PROGRAM_FORM_FORBIDDEN: legacy genericprogram(...)form is forbiddenSEM_PROGRAM_OWNER_MISMATCH: concrete*_program(...)kind is not valid for the owning operator familySEM_INVALID_PROGRAM_ARG_VALUE: program enum/token field value is unsupportedSEM_PROGRAM_ARG_CONFLICT: mutually exclusive program fields are supplied togetherSEM_FIELD_PROGRAM_FIELD_ALIAS:field_program.fieldis used instead offield_program.voltageSEM_UNKNOWN_REQUIREMENT:constraint(...)names an unknown requirementSEM_CONSTRAINT_BODY_REQUIRED:with constraint(...)is missing a bodySEM_CONSTRAINT_ITEM_REQUIRED:with constraint(...)provides neither requirement nor optionSEM_CONSTRAINT_DUPLICATE_OPTION: the same constraint option key appears more than onceSEM_CONSTRAINT_SCOPE_INVALID: requirement is not legal in the current scopeSEM_CONSTRAINT_CONFLICT: two active requirements conflictSEM_CONSTRAINT_CUSTOMIZED_EXCLUSIVE:customizedis mixed with standard requirementsSEM_CONSTRAINT_CUSTOMIZED_SCHEMA_REQUIRED:customizedomits requiredschema_refSEM_CONSTRAINT_UNKNOWN_OPTION: unsupported constraint option key is suppliedSEM_CONSTRAINT_ACTION_FAMILY_MISMATCH: active requirement disallows the action familySEM_CONSTRAINT_ENV_CONFLICT: active requirement conflicts with env settingsSEM_MATERIAL_TRANSITIONS_SHAPE_INVALID/SEM_MATERIAL_TRANSITION_SHAPE_INVALID/SEM_MATERIAL_TRANSITION_ARGS_INVALID: thesep.transitionscollection or onetransition(...)call has an invalid shape.SEM_MATERIAL_SELECTOR_INVALID/SEM_MATERIAL_SELECTOR_CONTAINER_MISMATCH: a transition subject or association target is neither a same-samplematerials[index]selector nor a same-samplematerials.get(entry_id)selector with a statically resolvable non-empty string key.SEM_MATERIAL_TRANSITION_OUTPUT_INVALID:outputis not a namespaced member of the concrete output enum owned by the selected separation program, including bare identifiers and members of another program's output enum.SEM_MATERIAL_TRANSITION_TARGET_INVALID:tois a string, a bare or unknown identifier, a member of another enum, or the internalMaterialRelation.UNRESOLVEDsentinel rather than an author-settableMaterialRelation.MEMBER.SEM_MATERIAL_TRANSITION_ASSOCIATION_REQUIRED/SEM_MATERIAL_TRANSITION_ASSOCIATION_FORBIDDEN/SEM_MATERIAL_TRANSITION_ASSOCIATION_INVALID:associated_withdoes not match the target relation's typed association contract.
8.3.1 Content/Constructor Semantic Diagnostics
Content descriptors are checked where they declare initial material or replacement products. Container construction also validates its own family and argument contract.
| Code | Condition |
|---|---|
SEM_MISSING_CONTENT_KIND | A content declaration is missing its required kind. |
SEM_INVALID_CONTENT_KIND | The supplied content kind is outside the canonical contract. |
SEM_INVALID_CONTENT_TYPE_FORMAT | A supplied content type is not in normalized identifier form. |
SEM_INVALID_CONTAINER_KIND | Container construction uses an unsupported concrete kind. |
SEM_MATERIAL_REPLACE_INVALID | Replacement has an invalid receiver, same-container selector map, value shape, product descriptor, or quantity declaration. |
Replacement shares normal descriptor checks; accepting the method shape does not bypass content validation. Source-dependent material constraints are checked at execution under Section 8.8.1.
8.3.2 Statement-First Mutation Semantic Diagnostics
For mutation statements (target << [sources...]) in the statement-first model:
SEM_MUTATION_PROGRAM_SOURCE_SHAPE_CONFLICT: mutation-specific program payloads are authored in a legacy shape that the source surface no longer accepts.SEM_STANDALONE_CONTENT_INIT_FORBIDDEN: execution flow contains standalonecontent/blood/buffer/...init as flowable material. Contract:These codes are part of the mutation/content-model contract.
The codes above are emitted in the pipeline.
8.4 Type Diagnostics (TYPE_*)
Primary type/unit diagnostics:
These codes cover quantity dimensions, unit families, typed assignment, and typed constructor/program fields:
TYPE_DIMENSION_MISMATCH: value has the wrong physical dimensionTYPE_UNKNOWN_UNIT: unit token is unknown to the typecheckerTYPE_UNIT_NOT_ALLOWED: a quantity/unit is not allowed in the contract positionTYPE_UNIT_LEGACY_ALIAS: unit token is accepted as a legacy alias but is not a canonical spellingTYPE_ENV_THERMAL_DIMENSION_MISMATCH:thermalvalue is not temperature-compatibleTYPE_ENV_DURATION_DIMENSION_MISMATCH:durationvalue is not time-compatibleTYPE_ENV_PERCENT_DIMENSION_MISMATCH:co2/rhvalue is not percent-compatibleTYPE_MUTATION_QUANTITY_UNIT_REQUIRED: quantified mutation source is missing a unit-bearing quantityTYPE_MUTATION_QUANTITY_DIMENSION_MISMATCH: quantified mutation source uses the wrong dimensionTYPE_LOAD_QUANTITY_UNIT_REQUIRED: constructor/load amount is missing required unit-bearing quantityTYPE_LOAD_QUANTITY_DIMENSION_MISMATCH: constructor/load amount uses the wrong dimensionTYPE_PROGRAM_FIELD_KIND_MISMATCH: program field has the wrong value kindTYPE_PROGRAM_FIELD_DIMENSION_MISMATCH: program quantity field has the wrong dimensionTYPE_LOCAL_ASSIGN_TARGET_FORBIDDEN: local assignment target form is not type-legalTYPE_LOCAL_ASSIGN_MISMATCH: assigned value is not type-compatible with the local targetTYPE_MEMBER_ASSIGN_TARGET_FORBIDDEN: member assignment target root is not type-legalTYPE_MEMBER_ASSIGN_PATH_FORBIDDEN: member assignment path is not allowedTYPE_CONTAINER_TARGET_VIEW_POSITION_INVALID: aContainerTargetViewis used where a materialContaineris requiredTYPE_QUANTITY_DIVISION_BY_ZERO: a quantity-expression denominator is known to be zero after binding resolution or concrete call expansion.TYPE_QUANTITY_VALUE_NONFINITE: a quantity calculation is not finitely representable, including a denominator that underflows to zero during conversion.
Expression results use the receiving slot's unit-required or dimension-mismatch code. This applies equally to literals, bindings, and calculated quantities. Deferred runtime failures retain the existing execution error path; they do not produce fabricated quantities.
8.4.0 Record Field Resolution Diagnostics
Record projection failures belong to semantic validation:
| Failure | Diagnostic |
|---|---|
| A known record lacks the requested field | SEM_RECORD_FIELD_MISSING |
| A field is read from a known non-record scalar or list | SEM_RECORD_MEMBER_BASE_INVALID |
| Alias or field resolution encounters a cycle | SEM_EXPRESSION_BINDING_CYCLE |
Unbound formal parameters defer value-dependent checks to concrete call expansion. Successful projection does not suppress receiving-operation type, unit, dimension, or separation-fate diagnostics. Enum namespace shadowing and domain member failures retain their owning domain diagnostics.
8.4.1 Content Metadata Type Diagnostics
TYPE_CONTENT_ATTRS_NOT_RECORD:attrsfor content declaration is not a record/map.TYPE_CONTENT_CODE_NOT_TEXT:content_codeis not text-like.TYPE_CONTENT_KIND_NOT_TEXT:content_kindargument is not text-like in constructor call.
Contract:
- These diagnostics are emitted by type/semantic boundary checks after constructor lowering.
8.5 Entry Resolution Diagnostics (ENTRY_*)
Entry resolution runs after semantic and type validation and before plan lowering:
ENTRY_LEGACY_IMPLICIT_PROTOCOL(warning): entry resolution selected the unique unreferenced root protocol through the version-scoped compatibility ruleENTRY_NO_ENTRYPOINT(error): the entry source contains no top-level executable statements and does not satisfy the compatibility entry rule
An entry-resolution error prevents plan execution. Dependency files do not undergo entry resolution and therefore may contain definitions without an executable entry.
8.6 Plan Diagnostics (PLAN_*)
Primary plan diagnostics:
These codes cover protocol-reference expansion, call-frame binding, and compatibility-entry parameter resolution:
PLAN_UNKNOWN_REFERENCE: referenced protocol cannot be found during plan expansionPLAN_REFERENCE_CYCLE: protocol-reference expansion forms a cyclePLAN_CALL_ARG_MISSING: a referenced protocol call is missing a required argumentPLAN_CALL_ARG_UNKNOWN: a referenced protocol call supplies an unknown argumentPLAN_CALL_ARG_DUPLICATE: a referenced protocol call duplicates an argument namePLAN_CALL_ARG_DEFAULT_EVAL_FAILED: a default parameter value cannot be resolved in call bindingPLAN_CALL_PARAM_REDECLARED: protocol body redefines a protected parameter namePLAN_ENTRY_PARAM_MISSING: the selected compatibility protocol is missing a required entry argumentPLAN_SELECTED_PROTOCOL_NOT_FOUND: plan lowering received a protocol entry resolution whose selected protocol is absent from the supplied IR program
These diagnostics cover repeated/recursive reference expansion and parameterized protocol binding failures.
8.7 Load Diagnostics (LOAD_*)
For entry-source loading and definition dependency loading, load/frontend stage may emit:
LOAD_DUPLICATE_PROTOCOL_NAME: loaded source files define the same protocol name twiceLOAD_NO_INPUT_SOURCES: no entry sources were providedLOAD_SOURCE_NOT_FOUND: an input source path cannot be foundLIB_IMPORT_NOT_FOUND: a library import cannot be resolvedLIB_IMPORT_CYCLE: library imports form a cycleLIB_PROTOCOL_NAME_CONFLICT: imported/external protocol names conflict with existing names
Contract:
- Load/frontend failures are decided by the source-loading / frontend-resolution stage and must not be replaced by
SEM_*codes. - Load/library failures may surface as hard exceptions with stable string prefixes rather than in-memory
Diagnosticobjects. LOAD_*covers entry-source and include dependency loading;LIB_*covers import resolution and external protocol namespace assembly.
8.8 Runtime and Material Diagnostics (RT_*, MAT_*)
Execution/runtime layer:
These codes cover scheduler/runtime orchestration failures and runtime binding failures that remain after earlier stages:
RT_DRIVER_ERROR: driver execution failedRT_MATERIAL_ERROR: runtime step failed because material update failedRT_ABORTED_AFTER_FAILURE: fail-fast runtime aborted further dispatch after a failureRT_UNSATISFIED_DEPENDENCY: a step cannot run because dependencies never became satisfiableRT_STUCK_STEP: scheduler detected no progress for pending workRT_SCHEDULER_GUARD_LIMIT: scheduler hit the no-progress/guard limitRT_RUNTIME_CONDITION_UNRESOLVED: runtime condition could not be evaluatedRT_DRIVER_REQUIREMENT_UNSUPPORTED: selected driver cannot satisfy an active requirementRT_LOCAL_ASSIGN_INVALID_TARGET: runtime local assignment target shape is invalidRT_LOCAL_ASSIGN_UNRESOLVED: runtime local assignment value could not be resolved or constructed from its bound fieldsRT_MEMBER_ASSIGN_TARGET_INVALID: runtime member assignment target is invalidRT_MEMBER_ASSIGN_VALUE_UNRESOLVED: runtime member assignment value could not be resolvedRT_APPEND_TARGET_INVALID: runtime append target is invalidRT_APPEND_VALUE_UNRESOLVED: runtime append value could not be resolvedRT_REPEAT_BODY_INVALID: repeat body structure is invalid at runtime executionRT_REPEAT_ITERABLE_INVALID: repeat iterable does not resolve to a valid runtime iterable
Material compute layer:
MAT_BINDING_NOT_FOUND: referenced runtime material or carrier binding cannot be resolvedMAT_INSUFFICIENT_VOLUME/MAT_INSUFFICIENT_MASS/MAT_INSUFFICIENT_COUNT: source material is insufficient for the requested transferMAT_DILUTION_UNDERSPECIFIED/MAT_DILUTION_INVALID_TARGET: dilution operation is missing required information or uses an invalid targetMAT_MISSING_DENSITY/MAT_INVALID_DENSITY: density bridge is required but missing or invalidMAT_INVALID_RECOVERY_RATIO: requested recovery ratio is invalidMAT_CONSERVATION_VIOLATION: material conservation check failedMAT_CONTAINER_OVERFLOW: post-step volume exceeds container capacityMAT_INVALID_CAPACITY: declared container capacity is invalidMAT_CONTENT_NOT_FOUND: referenced content identity cannot be resolved at material stageMAT_CONTENT_LOAD_AXIS_MISMATCH: requested content load axis is incompatible with runtime representationMAT_CONTENT_METADATA_CONFLICT: immutable content metadata conflict is detected at runtimeMAT_SCIENTIFIC_MODEL_UNRESOLVED: the selected provider is absent, not applicable, or returnsUNRESOLVED; committed material remains unchangedMAT_SCIENTIFIC_MODEL_FAILED: the selected provider fails; committed material remains unchangedMAT_SCIENTIFIC_MODEL_PROPOSAL_INVALID: kernel validation rejects a provider proposal; committed material remains unchangedMAT_UNSUPPORTED_UNIT: runtime material layer does not support the requested unit conversion or axisMAT_MOVEMENT_CONTRACT_MISSING: a successful material operation changed container quantities without exposing an auditable source-to-destination movement contractMAT_CELL_COUNT_VALUE_INVALID: an authored load or quantified transfer uses a negative or non-integral cell countMAT_INVALID_CELL_SUSPENSION_CONCENTRATION: required cell-suspension concentration is missing, non-finite, zero, or negativeMAT_COUNT_TRANSFER_SOURCE_NOT_SUSPENSION: a count aliquot is requested from adherent, pellet, or otherwise non-homogeneous materialMAT_COUNT_TRANSFER_AMBIGUOUS: a count aliquot does not identify one population when multiple cellular populations are presentMAT_IMPLICIT_CARRIER_OVERFLOW: constructor finalization would materialize implicit carrier beyond container capacityMAT_CONTENT_QUANTITY_AXIS_CONFLICT: the same content identity would merge incompatible quantity axesMAT_SEPARATION_FATE_COMPONENT_NOT_FOUND/MAT_SEPARATION_FATE_RULE_*: runtime source-dependent validation of authored component fate rules failedMAT_MATERIAL_INDEX_OUT_OF_RANGE/MAT_MATERIAL_ENTRY_ID_NOT_FOUND/MAT_MATERIAL_ENTRY_ID_AMBIGUOUS/MAT_MATERIAL_ENTRY_INVALID/MAT_MATERIAL_RELATION_INVALID: runtime cannot resolve exactly one selected live material entry or its current enum relation.MAT_MATERIAL_TRANSITION_TARGET_INVALID: the target is outside the author-settableMaterialRelationenum domain; free text andUNRESOLVEDare rejected.MAT_MATERIAL_TRANSITION_OUTPUT_EMPTY/MAT_MATERIAL_TRANSITION_OUTPUT_UNRESOLVED/MAT_MATERIAL_TRANSITION_DUPLICATE: the output-scoped transition cannot be applied uniquely to positive quantity.MAT_MATERIAL_TRANSITION_ASSOCIATION_REQUIRED/MAT_MATERIAL_TRANSITION_ASSOCIATION_FORBIDDEN/MAT_MATERIAL_TRANSITION_ASSOCIATION_KIND_INVALID/MAT_MATERIAL_TRANSITION_ASSOCIATION_OUTPUT_EMPTY: the target relationship's typed association invariant is not satisfied.MAT_PLATE_REF_INVALID: a carrier reference is malformed, inconsistent with its allocated carrier, or has incomplete well membership for a whole-carrier effect; reject before mutation. An absent carrier usesMAT_BINDING_NOT_FOUND.
Count-specific type diagnostics:
TYPE_CELL_COUNT_VALUE_INVALID: a statically visible authored cell count is negative or non-integral.TYPE_LOAD_COUNT_CONTENT_MISMATCH:cellsis applied to content that is statically known not to bebio_cellular.
8.8.1 Content Runtime Diagnostics
Content-aware execution validates identity, quantity representation, and the current source state before applying a material change. These failures retain normal binding and conservation diagnostics where those contracts are involved.
| Code | Condition |
|---|---|
MAT_CONTENT_NOT_FOUND | The referenced content identity cannot be resolved. |
MAT_CONTENT_LOAD_AXIS_MISMATCH | The requested load axis or amount is incompatible with the available representation. |
MAT_CONTENT_METADATA_CONFLICT | Immutable content metadata conflict during declaration or merge. |
MAT_MATERIAL_REPLACE_INVALID | Replacement arguments or the resulting entry set violate the replacement contract. |
MAT_MATERIAL_REPLACE_ACTIVE_PARTS | The receiver still has active indexed contents. |
MAT_MATERIAL_REPLACE_SOURCE_UNSUPPORTED | A selected source has no tracked mass, volume, or count quantity. |
MAT_MATERIAL_REPLACE_DUPLICATE_PRODUCT | A product repeats a content identity already present in the container or product list. |
MAT_QUANTITY_UNKNOWN | Numeric mass is required but unavailable, or an unknown-mass operation lacks explicit fates/free relationship or requests an unsupported relationship change. |
Material selectors retain their existing resolution diagnostics. A replacement failure leaves both the subject and product registrations unchanged, as required by Section 7.2.2. Scientific-model provider failures have the separate ownership and commit boundary in Section 8.8.2.
8.8.2 Scientific Model Diagnostics
MAT_SCIENTIFIC_MODEL_UNRESOLVED: no selected provider produced an applicable typed decision.MAT_SCIENTIFIC_MODEL_FAILED: the selected provider failed before producing a proposal.MAT_SCIENTIFIC_MODEL_PROPOSAL_INVALID: the selected provider produced a proposal rejected by kernel validation.
Contract:
- Provider diagnostics are structured evidence; they do not directly become committed runtime diagnostics.
- Runtime maps provider status and validation outcome to the codes above.
- Every failure path leaves committed material state unchanged.
- Runtime MUST NOT replace these outcomes with an equal-split or other guessed scientific result.
8.9 Earliest-Decidable Rule
Diagnostics should be emitted by the earliest stage that can decide them:
- Step/arg/name contract failures at semantic stage
- Constructor whitelist/shape failures at semantic stage
- Unit/dimension and metadata type incompatibilities at type stage
- Execution-entry selection at entry-resolution stage
- Reference graph and plan consistency issues at plan stage
- Source and dependency loading errors at load/frontend stage
- State-dependent failures at runtime/material stage
8.10 Diagnostic Object Contract
Diagnostic objects should include:
codemessageseverityspan(where available)node_id(where available)
Diagnostic object fields:
- The shared diagnostic object carries
code,message,severity,span, andnode_id. stageand stability classification are diagnostic classifications; they are not required fields on every in-memory diagnostic object.
8.11 Conformance Boundary
Diagnostic producers across source loading, semantic validation, type checking, entry resolution, planning, runtime execution, and material-state handling must conform to the diagnostic codes and stage placement in this chapter. Module layout and test file names are not part of the diagnostic contract.
