[data-reveal]{opacity:1!important;transform:none!important}
DocumentationTroubleshooting

Troubleshooting

Find the cause of common AntelopeJS startup, interface and lifecycle errors, and fix them.

Start with the first error, not the cleanup messages after it. Note the module ID, the lifecycle phase, the output of ajs --version, the Node.js version and the command you ran. Add --verbose to see the underlying exception. Remove credentials from logs before you share them.

SymptomFirst check
dist/index.js is missingBuild the module and check main in its package.json. Watch mode needs a configured build command.
A module requires a package that is not installedInstall the dependencies of the module the error names, then run ajs project modules install to add the modules that implement its interfaces.
A required interface has no providerAdd a module that provides it to the project. Adding the interface to dependencies is not enough.
Incompatible interface package resolutionRun ajs project modules install to get the exact range or lock change each module needs, and --fix to apply it. When it finds none, no installed copy satisfies every range: update the module whose range excludes the others.
Startup waits and never completesLook for construction cycles and for interface calls inside provide().
A route returns 404Import its controller file from the module entry point and rebuild.
A reload failsRead the original build, construct or start error, fix it, then save again.
Calls from an embedded host hangCall the interface through runtime.use() after startup, not through a plain interface import.

Interface not implemented

Note

This error occurs in tests that use stubs. The test runner turns stub mode on, and stub mode rejects a call to an interface that has no registered implementation.

Your test calls an interface function, but no module provides that interface in the test environment. Stub mode raises this error at once instead of leaving the call waiting on an unresolved proxy. The message reads Interface function called without implementation in test environment.

Tip

Load a real provider module or a test provider module in the modules map of the test configuration. Have that provider attach its implementation in construct(). The runner calls setup() before it loads modules, so do not call those interfaces from setup().

Incompatible interface package resolution

The runtime found providers, but the interface package it selected does not satisfy the declared range of every consumer. The error names the consumer, its range, the version and path of the shared copy, and the module that the shared copy was resolved from. ajs project build and ajs project modules install run the same check, so the error appears before you deploy the project. ajs project start and ajs project dev check again before they construct modules. A missing provider is a different error. Adding another provider does not fix a version disagreement.

For example, the range ^0.0.14 excludes 0.0.15. Read the changes in the newer contract, update the affected consumer to a compatible release or range, and reinstall its dependencies. A provider must implement every required function before it widens its supported range. Do not silence the error by declaring compatibility you have not tested.

Module failed to construct

Note

The module's construct() function threw an error. Common causes are missing configuration values, unavailable external services, and invalid setup logic.

If a required module fails to construct, the launch fails and the runtime cleans up the modules it has partly constructed. Other construction work can already be running. The error names the failing module and the original exception, and cleanup errors can appear with it.

Tip

Check your module's construct() function and the configuration that antelope.config.ts passes to it. Make sure every required configuration key is present. Make sure external services, such as databases and APIs, are reachable before the module connects to them.

Module failed to start

Note

The module's start() function threw an error. The runtime calls start() only after it has constructed every module, so this error usually points to a runtime problem, not a configuration problem.

The runtime awaits each start callback, including other starts that are already running, and cleans up after a failed required launch. The failed module never becomes active, so its destroy() must work without a stop() before it.

Tip

Make sure the external services your module depends on are available at start time. If a service can be unavailable for a while, catch the error in the module and retry, or run without that service.

Unresolved interface dependencies

Note

The core checks the interface dependency graph before it constructs modules. If a required interface has no provider in the current configuration, startup fails with this error.

A module declares that it consumes an interface, but no loaded module implements that interface. The core detects this before any construct() call, so the application never starts halfway. The error lists each module and the interface it requires, and suggests ajs project modules install.

Tip

Check that antelope.config.ts lists every required module and that each one implements the expected interfaces. Look for typos in interface package names. Check that the implementing module lists the interface in the antelopeJs.implements field of its package.json.

Package not installed

A module's code loads a package that its package.json declares in dependencies or optionalDependencies, and that package is not installed. The message reads <module> requires <package>, which is not installed and fails the start when the module loads. The core reads an interface package's own package.json to know it is an interface, so before the package is installed, the interface check cannot see it. ajs project modules install exits with the same <module> requires <package>, which is not installed reason for a package in dependencies that no module of the project implements.

Tip

Install the dependencies of the module: run its package manager in its folder, or give a local module an installCommand. Then run ajs project modules install, which adds a module for each interface that no module implements.

See also

  • Architecture explains how the core handles errors in each lifecycle phase.
  • Testing covers the test configuration and stub mode.
  • Configuration is the module configuration reference.