Reference
Error codes
The compiler and verification harness emit 47 structured ERR_* diagnostic codes. In --agent mode, errors return as structured JSON payloads ({ "status": "ERROR", "code": "ERR_...", "message": "..." }). In interactive mode, errors print to stderr with contextual source spans.
| Code | Emitted by | Meaning and remediation |
|---|---|---|
ERR_CONFIG_INVALID |
lib/compiler/config/project_config.dart |
aegil.yaml has a syntax error, unknown key, unsupported contract version, bad name/namespace casing, version range instead of an exact x.y.z pin, or a path outside the project, or an unsupported combination such as backend: serverpod with client: none. The message includes the line number. |
ERR_CONFIG_MISSING |
lib/compiler/config/project_config.dart |
The target project directory has no aegil.yaml. Every Aegil project requires aegil.yaml at its root (create one with aegil init). |
ERR_CREATE_INVALID |
bin/aegil.dart, lib/compiler/harness/project_creator.dart |
An argument to aegil create is invalid: no directory, a directory name that is not a valid snake_case project name (use –project-name), a bad –org, –id, –template, –backend or –client, or the unsupported combination serverpod with client none. create never prompts. Nothing was written. |
ERR_DELETED_GENERATED_FILE |
lib/compiler/harness/manifest_manager.dart |
A file listed in .aegil/manifest.json (generatedFileChecksums) was deleted from disk. Run aegil build –project |
ERR_DESTRUCTIVE_MIGRATION |
lib/compiler/harness/migration_manager.dart |
aegil migrate detected a destructive schema change (table drop, column drop, type change, or NOT NULL addition without default). Re-run with –allow-destructive to acknowledge. |
ERR_DIR_NOT_EMPTY |
lib/compiler/harness/project_creator.dart, lib/compiler/harness/project_initializer.dart |
aegil init or create refused to write because the target directory already contains files or folders that Aegil owns (listed in conflicts), or the path is not a directory. Nothing was written. |
ERR_DUPLICATE_DECLARATION |
lib/compiler/frontend/spec_loader.dart, lib/compiler/frontend/spec_parser.dart |
An enum, model, op, app or platform with the same name is declared in more than one .tsp file under specs/. |
ERR_EXPECTED_IDENTIFIER |
lib/compiler/frontend/spec_parser.dart |
A TypeSpec declaration, decorator name, model field name, or enum member was expected, but a different token or symbol was encountered. |
ERR_EXPECTED_SEMICOLON |
lib/compiler/frontend/spec_parser.dart |
A statement (such as namespace, model field, op, app, or platform) was missing its terminating semicolon ‘;’. |
ERR_INIT_INVALID |
lib/compiler/harness/project_initializer.dart |
An argument to aegil init (–name, –id, –namespace, –display-name, or target directory) is missing or fails validation (for example a Dart reserved word, non-reverse-DNS id, or display name over 60 characters). Nothing was written. |
ERR_INVALID_MANIFEST |
lib/compiler/harness/manifest_manager.dart |
.aegil/manifest.json is not valid JSON. Run aegil build –project |
ERR_INVALID_MANIFEST_PATH |
lib/compiler/harness/manifest_manager.dart |
A path in .aegil/manifest.json is absolute, empty, uses backslashes, or contains ‘..’ segments. Run aegil build –project |
ERR_LAYOUT_OUTDATED |
lib/compiler/layout/project_layout.dart |
The target project contains generated files or directories from a legacy layout (such as server/, generated/, or client/android at the project root). Generated code now lives under .aegil/. |
ERR_MISSING_MANIFEST |
lib/compiler/harness/manifest_manager.dart |
aegil verify was run before .aegil/manifest.json existed. Run aegil build –project |
ERR_NAMESPACE_CONFLICT |
lib/compiler/frontend/spec_loader.dart |
Two .tsp files in the same spec directory declare different namespace names. Every spec file in a project must declare the same namespace. |
ERR_NAMESPACE_MISMATCH |
bin/aegil.dart |
The merged spec’s namespace does not equal the namespace declared in aegil.yaml. |
ERR_PLATFORM_REQUIRES_APP |
lib/compiler/frontend/lowering.dart |
The spec declares a platform block, but no application declaration was found. Platform shells require an app declaration for app ID, display name, and version. |
ERR_PLATFORM_TEMPLATE_INVALID |
lib/compiler/emitters/platform_shell_emitter.dart |
A rendered platform shell file still contains an unresolved @@token@@ placeholder after substitution. |
ERR_PLATFORM_TEMPLATE_VERSION |
lib/compiler/emitters/platform_shell_emitter.dart |
aegil.yaml pins a Flutter minor version that differs from the Flutter version lib/templates/platforms/ was derived from (3.35.x). Pin a matching 3.35.x Flutter version or run dart run tool/update_platform_templates.dart. |
ERR_PLATFORM_TEMPLATES_MISSING |
lib/compiler/emitters/platform_shell_emitter.dart |
The compiler could not locate lib/templates/platforms/ inside the aegil package. |
ERR_PLATFORMS_REQUIRE_SERVERPOD_LAYOUT |
lib/compiler/targets/flutter_client_target.dart, lib/compiler/targets/none_client_target.dart |
The spec declares a platform block (specs/platforms.tsp), but aegil.yaml sets layout: standalone. Native platform shells require layout: serverpod. |
ERR_PUB_GET_FAILED |
lib/compiler/targets/flutter_client_target.dart |
flutter pub get exited non-zero in the generated workspace during aegil build. The JSON output includes stdout and stderr. |
ERR_PUBLIC_INVALID |
lib/compiler/frontend/lowering.dart |
@public was used where a signed-in caller is needed: on a custom @mutation or an @autoStream, on an operation that declares its own policy, on an entity that has an @policy, or on an @autoMutation whose entity has an owner column (ownerId, customerId, reporterId or userId). The message names the operation. Nothing was written. |
ERR_RUN_DATABASE_FAILED |
lib/compiler/harness/app_runner.dart |
The Postgres container for aegil run could not start or did not become ready in time, or the server was rejected with ‘password authentication failed’ because the database volume was created with a different password (for example the project was recreated in the same directory). In that case run aegil run –reset-db, which recreates the database; its data is lost. Everything aegil run started was stopped. |
ERR_RUN_DOCKER_UNAVAILABLE |
lib/compiler/harness/app_runner.dart |
aegil run needs Docker for the Postgres database and the Docker daemon did not answer. Start Docker and run again; nothing was started. |
ERR_RUN_SERVER_FAILED |
lib/compiler/harness/app_runner.dart |
The database migration failed, or the Serverpod server exited or did not answer on its API port in time. The output shows the last lines the server printed. Everything aegil run started was stopped. |
ERR_RUN_STOPPED |
bin/aegil.dart, lib/compiler/harness/app_runner.dart |
aegil run was stopped (Ctrl-C) before the app started. Exit code 130; everything it started was stopped. |
ERR_RUN_UNSUPPORTED |
bin/aegil.dart |
aegil run supports projects with backend: serverpod and client: flutter. Other combinations are not supported yet. |
ERR_SERVER_FEATURE_WITHOUT_BACKEND |
lib/compiler/harness/project_creator.dart, lib/compiler/targets/none_backend_target.dart |
The spec declares a server-only feature (@policy, custom mutation hooks, or @autoStream), but aegil.yaml declares backend: none. Policies, hooks and streams require a server backend. |
ERR_SERVERPOD_GENERATE_FAILED |
lib/compiler/targets/serverpod_backend_target.dart |
serverpod generate exited non-zero in server/ during aegil build. The build stops immediately rather than continuing with stale or missing protocol files. |
ERR_SPEC_INVALID |
bin/aegil.dart, lib/compiler/frontend/decorator_syntax.dart, lib/compiler/frontend/lowering.dart, lib/compiler/harness/migration_manager.dart |
A .tsp specification file has an invalid decorator, unknown key, malformed value, invalid CEL policy expression, unsupported auth provider/token, bad hostname, or an unsupported @permission/@platform combination. |
ERR_SPEC_MISPLACED |
lib/compiler/frontend/spec_loader.dart |
A specification file is in the wrong location: only app.tsp and platforms.tsp may live directly under specs/; all domain code must live in a one-level snake_case feature directory (specs/ |
ERR_SPEC_NOT_FOUND |
lib/compiler/frontend/spec_loader.dart, lib/compiler/harness/agent_context.dart |
No .tsp specification files were found at the configured specs path ( |
ERR_SPEC_SYNTAX |
lib/compiler/frontend/lexer.dart, lib/compiler/frontend/source_span.dart, lib/compiler/frontend/spec_parser.dart |
A syntax error was encountered while lexing or parsing a TypeSpec specification file. The error includes source line, column range, and a fix suggestion. |
ERR_SPECS_INVALID |
bin/aegil.dart |
An unknown subcommand or invalid argument was passed to aegil specs. Supported subcommands: list. |
ERR_STALE_BUILD |
bin/aegil.dart |
The hash lock matches the last build, but recomputing the build plan from the current specs, hooks and compiler produces different generated files (or different file sets). Run aegil build –project |
ERR_STALE_HOOK_MIRROR |
lib/compiler/harness/agent_harness.dart, lib/compiler/harness/manifest_manager.dart |
A hand-written hook in hooks/_hook.dart was edited after the last build, so server/lib/src/hooks/_hook.dart still holds the old copy. Run aegil build –project |
ERR_STALE_MANIFEST |
lib/compiler/harness/manifest_manager.dart |
.aegil/manifest.json has an older manifestVersion than the current compiler expects. Run aegil build –project |
ERR_TAMPERED_GENERATED_FILE |
lib/compiler/harness/agent_harness.dart, lib/compiler/harness/manifest_manager.dart |
A file listed in generatedFileChecksums in .aegil/manifest.json was modified after aegil build. Generated files are strictly read-only; make changes in specs/.tsp or hooks/_hook.dart and rebuild. |
ERR_TOOLCHAIN_MISMATCH |
lib/compiler/harness/toolchain.dart |
A tool (dart, flutter, or serverpod) was found on PATH, but none of the installed candidates matched the exact version pinned in aegil.yaml. |
ERR_TOOLCHAIN_MISSING |
lib/compiler/harness/project_creator.dart, lib/compiler/harness/toolchain.dart |
A required tool (dart, flutter, or serverpod) was not found on PATH (or in the Flutter-bundled Dart SDK / PUB_CACHE/bin). |
ERR_UI_BOUNDARY_VIOLATION |
lib/compiler/harness/zone2_verifier.dart |
A hand-written Flutter UI file under client/lib/ imported generated internals (.aegil/, src/generated/, |
ERR_UNKNOWN_DECORATOR |
lib/compiler/frontend/lowering.dart, lib/compiler/frontend/source_span.dart |
A decorator name written above a model, field, op, app, or platform is not recognized by Aegil. |
ERR_UNMIGRATED_SCHEMA |
lib/compiler/harness/migration_manager.dart |
The current specs differ from the latest committed migration under migrations/. Run aegil migrate –name |
ERR_UNTERMINATED_BLOCK |
lib/compiler/frontend/lexer.dart, lib/compiler/frontend/policy_parser.dart, lib/compiler/frontend/spec_parser.dart |
A brace ‘{’, parenthesis ‘(’, or bracket ‘[’ was opened but not closed before the end of the file or next declaration. |
ERR_UNTERMINATED_STRING |
lib/compiler/frontend/lexer.dart |
A string literal was started with a single or double quote but not terminated before the end of the line or file. |
ERR_WRITE_OUTSIDE_OWNERSHIP |
lib/compiler/harness/output_plan.dart |
The build plan attempted to write to a spec-owned path (aegil.yaml, specs/**), generate into a hand-written directory outside allowed exceptions, omit a localSecret from .gitignore, or write a duplicate/invalid path. Nothing was written. |
Generated from aegil @ 948ae8e. Do not edit: change the code, or the description in site/annotations/.