# Problem codes: Submodels and libraries

Submodel definitions and instances, asset libraries and catalogues. The list is generated from the codes' own table; the meaning is the table's sentence for the code.

| Code | Severity | Meaning | About |
|---|---|---|---|
| <span id="e_asset_3d"></span>`E_ASSET_3D` | error | A block's asset_3d is not "library/asset": lower-case letters, digits and underscores on each side of one slash. It only picks the 3D view's mesh. On screen: "Block {block}: the 3D asset {value} is not written library/asset" | -- |
| <span id="e_asset_block_type"></span>`E_ASSET_BLOCK_TYPE` | error | An asset uses a block type this build does not register (needs a plugin). | -- |
| <span id="e_asset_code"></span>`E_ASSET_CODE` | error | A library carries executable content (custom_logic, a plugin reference, Python). | -- |
| <span id="e_asset_definition"></span>`E_ASSET_DEFINITION` | error | An asset's definition is invalid by the ordinary model validator. | -- |
| <span id="e_asset_geometry"></span>`E_ASSET_GEOMETRY` | error | An asset's "geometry" fragment is malformed, or a block inside it binds to a node the fragment does not declare. | -- |
| <span id="e_asset_graphic"></span>`E_ASSET_GRAPHIC` | error | A graphic names an unknown state, or its SVG is unsafe or over the size cap. | -- |
| <span id="e_asset_id"></span>`E_ASSET_ID` | error | An asset has an empty or duplicate id. | -- |
| <span id="e_asset_migration"></span>`E_ASSET_MIGRATION` | error | An asset's "migrations" entry is malformed: a bad semver range, an unknown step, or a step naming a parameter this version lacks. | -- |
| <span id="e_asset_parameter"></span>`E_ASSET_PARAMETER` | error | A parameter's type, default, range or choices are inconsistent. | -- |
| <span id="e_asset_requires"></span>`E_ASSET_REQUIRES` | error | An asset's required model-level records name an unknown section, or are malformed. | -- |
| <span id="e_asset_test"></span>`E_ASSET_TEST` | error | An asset test entry is malformed. | -- |
| <span id="e_asset_test_failed"></span>`E_ASSET_TEST_FAILED` | error | An asset test's KPI is outside its tolerance. | -- |
| <span id="e_asset_unknown_name"></span>`E_ASSET_UNKNOWN_NAME` | error | A definition expression names something that is no parameter, variable or built-in (often a misspelt parameter). | -- |
| <span id="e_catalogue_column"></span>`E_CATALOGUE_COLUMN` | error | A catalogue row is missing a declared column, or a preset maps a column the catalogue does not declare. | -- |
| <span id="e_catalogue_value"></span>`E_CATALOGUE_VALUE` | error | A catalogue cell's type does not fit the parameter the preset maps it to. | -- |
| <span id="e_duplicate_submodel_port"></span>`E_DUPLICATE_SUBMODEL_PORT` | error | Two ports on the same side share a name. On screen: "{label}: two {side} ports are named {port}" | [DUPLICATE](../blocks/duplicate.md), [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_extends_cycle"></span>`E_EXTENDS_CYCLE` | error | A definition (or library asset) extends itself, directly or transitively . On screen: "Submodels extend each other in a loop: {loop}" | -- |
| <span id="e_extends_unknown"></span>`E_EXTENDS_UNKNOWN` | error | A definition's `extends` names no definition in the model (or an asset's, no asset of the same library). On screen: "Submodel {submodel} extends {parent}, which does not exist" | -- |
| <span id="e_library_catalogue"></span>`E_LIBRARY_CATALOGUE` | error | A catalogue's shape is wrong: no name, no columns, a duplicate name, or a row that is not an object. | -- |
| <span id="e_library_format"></span>`E_LIBRARY_FORMAT` | error | A library file is not an object, or its format_version is unknown. | -- |
| <span id="e_library_header"></span>`E_LIBRARY_HEADER` | error | A library header field is missing or malformed (id, name, semver version). | -- |
| <span id="e_library_version"></span>`E_LIBRARY_VERSION` | error | A library needs a newer schema version than this build supports. | -- |
| <span id="e_submodel"></span>`E_SUBMODEL` | error | A submodel section problem reported while flattening. On screen: "A submodel could not be put together" / "Submodel {submodel}: its definition must be an object" / "A submodel link names a block that does not exist" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_arguments"></span>`E_SUBMODEL_ARGUMENTS` | error | A SUBMODEL instance's arguments are not an object. On screen: "Block {block}: submodel arguments must be an object" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_argument_missing"></span>`E_SUBMODEL_ARGUMENT_MISSING` | error | An instance omits a declared parameter that has no default. On screen: "Block {block}: missing argument {param} for submodel {submodel}" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_argument_unknown"></span>`E_SUBMODEL_ARGUMENT_UNKNOWN` | error | An instance passes an argument the definition does not declare. On screen: "Block {block}: unknown argument {key} for submodel {submodel}" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_arg_reference"></span>`E_SUBMODEL_ARG_REFERENCE` | error | A `refers_to` argument names a record the model does not declare. On screen: "{block}: argument {name} names {value}, which is not defined" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_arg_type"></span>`E_SUBMODEL_ARG_TYPE` | error | A {"$arg": ...} value does not fit the type its target declares. On screen: "Repeat count: {arg} is {value}, not a whole number" / "{block}: {arg} is {value}, the wrong type" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_arg_unknown"></span>`E_SUBMODEL_ARG_UNKNOWN` | error | A {"$arg": ...} names a parameter the definition does not declare. On screen: "Block {block}: parameter {parameter} used outside a submodel" / "Submodel {submodel}: {arg} is not one of its parameters" / "Repeat count uses {arg}, which is not a parameter" / "{block}: {arg} is not a parameter of this submodel" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_cycle"></span>`E_SUBMODEL_CYCLE` | error | A submodel definition instantiates itself, directly or transitively. On screen: "Submodel definitions loop: {loop}" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_dead_end"></span>`E_SUBMODEL_DEAD_END` | error | A definition with no SUB_EXIT has a block that is not a DISPOSE dead end. On screen: "Submodel {submodel}: block {block} is a dead end" | [DISPOSE](../blocks/dispose.md), [SUBMODEL](../blocks/submodel.md), [SUB_EXIT](../blocks/sub-exit.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_port_name"></span>`E_SUBMODEL_PORT_NAME` | error | A submodel port has no name. On screen: "{label}: a {side} port has no name" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_port_required"></span>`E_SUBMODEL_PORT_REQUIRED` | error | A link to/from an instance must name a port. On screen: "Link {link}: choose a {side} port; {submodel} has {n} {port_side} ports" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_port_unknown"></span>`E_SUBMODEL_PORT_UNKNOWN` | error | A link names a port the definition (or, with repeat groups, this instance) does not have. On screen: "Link {link}: submodel {submodel} has no {port_side} port {port}" / "Link {link}: submodel {submodel} has no {port_side} port {port}" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_repeat"></span>`E_SUBMODEL_REPEAT` | error | A definition's repeat group or {i} placeholder is malformed. On screen: "Submodel {submodel}: a repeat group is wrong" / "Block {block}: repeating only works inside a submodel" / "Failure {failure} needs a copy number in its name" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_repeat_count"></span>`E_SUBMODEL_REPEAT_COUNT` | error | A repeat count is not an int in 0..500, or an optional group's count is above 1. On screen: "Repeat count {raw} cannot be worked out" / "Repeat count {raw} is not a whole number" / "Repeat count {count} is outside 0 to {max}" / "Repeat group {index}: count {count} needs the copy number in block names" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_scope"></span>`E_SUBMODEL_SCOPE` | error | SUB_ENTRY/SUB_EXIT used outside a submodel definition. On screen: "Block {block}: {kind} only works inside a submodel" | [SUBMODEL](../blocks/submodel.md), [SUB_ENTRY](../blocks/sub-entry.md), [SUB_EXIT](../blocks/sub-exit.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_submodel_scoped_name"></span>`E_SUBMODEL_SCOPED_NAME` | error | A `$name` in a definition has no top-level template to clone. On screen: "Submodel {submodel}: {value} has no template at the top level" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="e_unknown_submodel"></span>`E_UNKNOWN_SUBMODEL` | error | A SUBMODEL instance names a definition that does not exist. On screen: "Block {block}: unknown submodel {submodel}" | [SUBMODEL](../blocks/submodel.md), [`submodels`](../model-file/submodels.md) |
| <span id="w_library_item_clash"></span>`W_LIBRARY_ITEM_CLASH` | warning | A required model-level record already exists under that name with different content; the model's own record is used. On screen: "The model's own {kind} {name} differs from the asset's" | -- |
| <span id="w_library_upgrade"></span>`W_LIBRARY_UPGRADE` | warning | A definition's library has a newer version installed. | -- |

## How to fix

Each code with the usual remedy:

- `E_ASSET_BLOCK_TYPE`: Replace the block's `type` in the asset's `definition.blocks` with a built-in block type, or install the plugin that registers it. Until then the asset stays unavailable.
- `E_ASSET_CODE`: Remove every `custom_logic`, `python`, `plugin`, `entry_point` or `code` key from the file, and replace any LOGIC block in a `definition` with DECIDE and ASSIGN blocks. A library is data only.
- `E_ASSET_DEFINITION`: Give the asset a `definition` object with a `blocks` list of block objects, then fix what the message names. The definition is checked like any submodel, so a bad link or parameter fails here.
- `E_ASSET_GEOMETRY`: Give each entry in `geometry.nodes` a unique `name` and numeric `dx` and `dy`, with `attach` true or false. Each segment's `from` and `to`, and every `$node` a block binds, must name a declared node.
- `E_ASSET_GRAPHIC`: Fix the graphic the path names. Use only the states `idle`, `busy`, `down`, `off` and `blocked`, include `idle`, keep each SVG safe and small, write colours as `#RRGGBB`, and draw `icon` on `viewBox="0 0 24 24"`.
- `E_ASSET_ID`: Give every asset an object with a unique `id` made of letters, digits, `_`, `-` or `.`, starting with a letter or digit.
- `E_ASSET_MIGRATION`: Give each `migrations` entry a semver range in `from`, such as `^1.2.0`, and a non-empty `steps` list. Each step is one `rename_parameter`, `set_default` or `rename_record` naming a parameter or record kind this version declares.
- `E_ASSET_PARAMETER`: Give each entry in `parameters` a unique identifier `name` and a known `type`, with a `default` that fits it. A `choice` needs `choices` holding the default, and a number must lie within numeric `min` and `max`.
- `E_ASSET_REQUIRES`: Make `requires` an object whose keys are model sections, such as `resources` or `variables`, each a list of records with a `name`. Move any `$arg` value into the definition's `scoped` overrides, because required records are copied as written.
- `E_ASSET_TEST`: Make `tests` a list of objects, each with a non-empty `expect` list. Every expectation needs a numeric `value` and one of `key`, `kpi`, `exit` or `resource`, and every `records` probe needs a `name` and an `expression`.
- `E_ASSET_UNKNOWN_NAME`: Correct the name in the definition expression, or declare it in the asset's `parameters`. A variable the surrounding model supplies goes in `requires.variables`, or in a test's `model.variables`.
- `E_CATALOGUE_COLUMN`: Give every row in the catalogue's `rows` a value for each name in its `columns`. In the asset's `preset.map`, map only declared columns to parameters the asset declares in `parameters`.
- `E_CATALOGUE_VALUE`: Correct the catalogue cell so it fits the parameter the `preset.map` fills with it, for example a number within the parameter's `min` and `max`, or one of its `choices`.
- `E_DUPLICATE_SUBMODEL_PORT`: Rename one of the two `SUB_ENTRY` or `SUB_EXIT` blocks' `port` values in the definition. Port names must be unique per side, so links can say which port they mean.
- `E_EXTENDS_CYCLE`: Change one `extends` in the loop the message shows so it names a definition outside the chain, or remove it. A definition cannot extend itself, directly or through another definition.
- `E_EXTENDS_UNKNOWN`: Set the definition's `extends` to the name of an existing definition under `submodels`, or remove `extends`. The hint lists the definitions you can extend.
- `E_LIBRARY_CATALOGUE`: Give each entry in `catalogues` a unique `name`, a non-empty list of string `columns` that includes its `key`, and at least one row. A `preset` must name a declared catalogue and give a non-empty `map`.
- `E_LIBRARY_FORMAT`: Make the file a JSON object with `format_version` 1 and at least one entry in `assets`. If present, `entities` must be a list of objects with unique names.
- `E_LIBRARY_HEADER`: Give the file a `library` object with an identifier `id`, a non-empty `name` and a semver `version` such as `1.0.0`. An optional `color` must be `#RRGGBB`, and `min_schema_version` a whole number.
- `E_LIBRARY_VERSION`: Lower `library.min_schema_version` to a model schema version this build writes, if the library does not use the newer schema. Otherwise use a newer engine, or an older release of the library.
- `E_SUBMODEL`: Read the message for the definition that failed to flatten. The usual causes are a missing definition, an argument the definition does not declare, or a link to a port that does not exist.
- `E_SUBMODEL_ARGUMENTS`: Make the instance's `arguments` an object that maps each declared parameter name to its value, for example `{"capacity": 2}`, or remove it to use the defaults.
- `E_SUBMODEL_ARGUMENT_MISSING`: Add the parameter to the SUBMODEL instance's `arguments`, or give it a `default` in the definition's `parameters`. The message names the missing parameter.
- `E_SUBMODEL_ARGUMENT_UNKNOWN`: Remove the argument from the instance's `arguments`, or rename it to a parameter the definition declares. The hint lists the definition's `parameters`; a typo is the usual cause.
- `E_SUBMODEL_ARG_REFERENCE`: Declare the named record in the model's matching section, or pass the name of one that exists. The hint lists the records the argument may refer to.
- `E_SUBMODEL_ARG_TYPE`: Pass an argument of the type the target parameter or repeat count declares, for example an int rather than `2.5` or text. The message names the `$arg` and the value it received.
- `E_SUBMODEL_ARG_UNKNOWN`: Declare the parameter in the definition's `parameters`, or correct the `{"$arg": ...}` name to one it declares. A `$arg` outside any submodel definition must become a plain value.
- `E_SUBMODEL_CYCLE`: Break the loop the message shows by removing or replacing a SUBMODEL block that instantiates a definition earlier in the chain. A definition cannot contain itself, directly or through another.
- `E_SUBMODEL_DEAD_END`: Add a `SUB_EXIT` block to the definition and link the named block to it, or end that flow in a `DISPOSE`. Without an exit every flow must end in a DISPOSE.
- `E_SUBMODEL_PORT_NAME`: Give every `SUB_ENTRY` and `SUB_EXIT` block in the definition a non-empty `port` parameter, such as `in` or `out`. Links to the instance pick a port by this name.
- `E_SUBMODEL_PORT_REQUIRED`: Set the link's `source_port` or `target_port` to one of the instance's ports. A port may be left out only when the definition has exactly one port on that side.
- `E_SUBMODEL_PORT_UNKNOWN`: Set the link's `source_port` or `target_port` to a port the instance has, as listed in the hint. With repeat groups, lowering a count removes ports: delete the link or change the arguments.
- `E_SUBMODEL_REPEAT`: Fix the definition's `repeat` groups as the message says. Each needs `count` and a non-empty `blocks` list of its own blocks, and `{i}` goes in every repeated name or in none.
- `E_SUBMODEL_REPEAT_COUNT`: Make the group's `count` an int from 0 to 500, a `{"$arg": ...}` or an expression of the definition's parameters. A group whose names lack `{i}` takes only 0 or 1.
- `E_SUBMODEL_SCOPE`: Move the `SUB_ENTRY` or `SUB_EXIT` block into a definition under `submodels`, or delete it. Port blocks mean something only inside a submodel definition.
- `E_SUBMODEL_SCOPED_NAME`: Declare a top-level record named as the `$name` without its `$`, in the section the message names. Flattening clones that template for each instance.
- `E_UNKNOWN_SUBMODEL`: Set the instance's `definition` to the name of a definition under `submodels`, as listed in the hint, or add the missing definition. A typo is the usual cause.
- `W_LIBRARY_ITEM_CLASH`: Check the model's own record against the one the asset ships. If they are different things, rename one; if the model's copy is intended, the warning can stay.
- `W_LIBRARY_UPGRADE`: Add a `migrations` entry to the new asset version with a `rename_parameter` step from the old parameter name to the new one, so instances keep the argument's value. Or keep the old parameter in `parameters`.

[All problem codes](index.md)
