Skip to content

Diagnostics

Complete reference of all IonPath compiler diagnostic codes. Each code has a severity level, a message template, and guidance on how to fix the issue.

General Validation

ION0001 Error

Cyclic module import detected: {0}

Module A imports B and B imports A (directly or transitively). Break the cycle by extracting shared types into a third module that both can import.

ION0002 Error

Duplicate definition of '{0}' in module '{1}'

Two types, messages, or services share the same name. Rename one of them.

ION0003 Error

Type '{0}' not found or is not a standard builtin type

The base type for an enum or attribute argument is not a valid built-in type. Use a primitive like u1, u4, string, etc.

ION0004 Error

Type '{0}' is not allowed in attribute arguments

Attribute arguments must be scalar types. You cannot use a message or union type as an attribute parameter.

ION0005 Error

Attribute '{0}' not found

The referenced attribute is not declared. Either declare it with attribute @name(...); or import the module that defines it.

ION0009 Error

Unresolved reference to type '{0}'

The type doesn't exist in any imported module. If it's a typo, the compiler will suggest the closest match: "Did you mean '{1}'?" (via Levenshtein distance).

Enum & Flags Validation

ION0006 Error

Duplicate enum item name '{0}' in enum '{1}'

Two members in the same enum/flags share the same name.

ION0007 Error

Invalid value '{0}' for enum '{1}'

Enum values must be constant integer expressions (literals or bit-shift expressions like 1 << 3).

ION0008 Error

Duplicate enum value in enum '{1}'

Two members resolve to the same numeric value.

ION0011 Error

Enum item '{0}' has overlapping bits with '{2}'

Flags-specific: two members share overlapping bits, which would make them indistinguishable when combined.

Union & Service Validation

ION0012 Error

Union '{0}' declares shared fields but contains type reference case

Unions with type reference cases (e.g., union R { UserData, ErrorInfo }) cannot also have shared fields. Use inline cases instead.

ION0013 Error

Method '{0}' declares multiple stream parameters

Only one parameter per service method can be marked as stream.

ION0030 Error

Circular type reference detected: {0}

Types form a cycle (A → B → A). This would cause infinite recursion during serialization. Break the cycle by making one of the references optional (T?).

Schema Lock Violations (ION0020–ION0029)

These diagnostics fire when the current schema differs from the locked schema in ion.lock.json:

ION0020 Error

Breaking change: field '{0}' (index {1}) was removed from '{2}'

A field that was locked has been removed. Use --update-lock to acknowledge.

ION0021 Error

Breaking change: field '{0}' changed index from {2} to {3}

Field order determines wire identity. Reordering breaks all existing clients.

ION0022 Error

Breaking change: field '{0}' changed type from '{2}' to '{3}'

Changing a field's type changes the wire encoding. Existing clients cannot deserialize.

ION0023 Error

Breaking change: definition '{0}' was removed

A locked type/service was completely removed from the schema.

ION0024 Error

Breaking change: definition '{0}' changed kind from '{1}' to '{2}'

E.g., changing a msg to an enum.

ION0025 Warning

Service '{0}' removed method '{1}'

Removing a service method will break existing clients that call it.

ION0026 Error

Breaking change: method '{0}.{1}' signature changed

Method arguments or return type changed.

ION0027 Error

Breaking change: enum/flags '{1}' member '{2}' changed value

Changing an enum or flags member's numeric value breaks wire compatibility.

ION0028 Error

Breaking change: union '{0}' case '{1}' changed index

Union case index is the wire discriminator. Reordering changes the meaning of each case.

ION0029 Warning

Field '{0}' added to '{1}' is not nullable

Adding a required field is safe for new clients but older clients reading the previous schema won't have this field. Consider making it optional (T?).

Module System (ION0040–ION0048)

These diagnostics relate to external module dependencies declared in ion.config.json:

ION0040 Error

Circular module dependency detected: {0}

Module A depends on B and B depends on A (directly or transitively). Break the cycle by extracting shared types into a third module.

ION0041 Error

Module '{0}' config not found at path '{1}'

The module path in ion.config.json doesn't point to a directory with a valid ion.config.json. Check that the relative path is correct.

ION0042 Error

Unknown module '{0}'

A #import references a module that is not declared in the modules section of ion.config.json.

ION0043 Error

Type '{0}' not found in module '{1}'

The imported type does not exist in the target module. Verify the type name and ensure it is defined in one of the module's .ion files.

ION0044 Error

Type '{0}' not found in module '{1}'. Did you mean '{2}'?

Similar to ION0043 but the compiler found a close match — check for typos.

ION0045 Warning

Imported type '{0}' from module '{1}' is never used

Remove the unused import to keep your code clean.

ION0046 Error

Module '{0}' content hash has changed since last lock

The module's source files changed since the lock file was generated. Run ionc lock update to acknowledge.

ION0047 Warning

#use is deprecated

Migrate to the #import { Type } from "module" syntax. See Directives.

ION0048 Warning

Type '{0}' has the same name as a type from module '{1}'

Cross-module name collision. Rename one of the types to avoid ambiguity.

Unused Symbols (ION1001–ION1003)

Informational diagnostics reported when symbols are defined but never referenced:

ION1001 Info

Type '{0}' is defined but never referenced

The type is not used by any service method, field, or union case. It may be safe to remove.

ION1002 Info

Import '{0}' is unused

No types from this imported file are referenced. Remove the import.

ION1003 Info

Field '{0}' in '{1}' is never used

The field is not referenced by any service method.