Skip to main content

Errors

SDK errors carry a stable code, a hint that says how to fix the problem, and a docUrl that points to its entry below. error.format() prints all three.

try {
createGraph({ name: "broken" }).edge("a", "b").compile();
} catch (error) {
if (error instanceof AiluSdkError) console.error(error.format());
}

Building a graph​

AILU_GRAPH_COMPILE​

GraphCompileError. The graph is invalid: an edge to a node that doesn't exist, a missing entry node, an unknown channel, and so on. The message lists every problem with its own code. Fix each one, or use safeCompile() to get the problems as a value.

AILU_DUPLICATE_NODE​

DuplicateNodeError. Two nodes have the same id. Give each node a unique id.

AILU_MISSING_HANDLER​

MissingHandlerError. A .node() was added without a handler. Pass one: .node("id", async () => ({})).

AILU_UNKNOWN_NODE​

UnknownNodeError. An edge, a condition or entry() names a node that doesn't exist. Add the node before you reference it.

AILU_GOVERNANCE_MIDDLEWARE_REJECTED​

GovernanceMiddlewareRejectedError. An agent's middleware list contains a governance kind (redaction, approval gate, file policy). Those are applied by the engine and can't be set or removed per agent. Keep only structuredOutput, terse, contextBudget, compress and reflection.

Running a graph​

AILU_RUST_ENGINE_REQUIRED​

RustEngineRequiredError. The native engine didn't load, so the graph can't run. Check that your platform is supported (Install). This error also appears when a graph uses a removed option: an approvalEngine on agentNode, or AILU_SDK_ENGINE=ts. See Migrating.

AILU_NO_SUSPENDED_STATE​

ResumeStateNotFoundError. resume, approveAndResume or signal was called with a run id this CompiledGraph doesn't hold: another instance started it, the process restarted, or the run already finished. To resume across processes, use the catalog runner (Long-running runs).

AILU_APPROVER_REQUIRED​

ApproverRequiredError. approveAndResume was called without resolvedBy, or with an empty one. Pass the person who approved, from your authenticated session: approveAndResume(runId, { approvedTools, resolvedBy: "alice@example.com" }).

AILU_APPROVAL_NOT_GRANTED​

ApprovalNotGrantedError. resumeCatalogGraph was given an approvalEngine, and the engine doesn't authorize the resume: a request the run waits on is still pending, a human gate or a gated tool was rejected (since 2.7.0, ADR 0053 D4), a request was approved by the agent or gate that asked for it, a tool in approvedTools has no request approved by the person the grant names (also when the run filed no request, or isn't suspended — since 2.7.1), or the run was started without the engine. error.problems lists each one. Nothing ran; resolve the requests with approve(id, approver) or reject(...) and resume again.

AILU_APPROVAL_REFUSED​

ApprovalRefusedError. runCatalogGraph or resumeCatalogGraph was given an approvalEngine, and the run waits on something no person can decide: an approval-gated tool asked for inside a subgraph's child run. No grant can reach a child run yet, so approving it would loop the run. Nothing is filed.

Catch it, fail the run with error.reason, and don't retry it. error.outcome is the run's outcome when the run had executed before it was refused: keep its replayJournal as for any other run. It is absent when a resume is refused before anything runs. error.state is where the run stopped. To make the graph work, move the gated tool out of the subgraph, or gate the step with a human-gate node. In Python, ailu.ApprovalRefusedError.

error.state and error.outcome hold every channel of the run, personal data included. Never log them as they are: log error.code and error.reason. In TypeScript they are not enumerable, so JSON.stringify(error) and a logger's error serializer leave them out.

Without an approvalEngine, the run isn't refused, and the grant doesn't reach the child either: it suspends again at the same call on every resume. Don't put an approval-gated tool in a subgraph until the grant can reach child runs.

AILU_HOST_NODE_BINDING​

HostNodeBindingError. A nodes binding given to runCatalogGraph or resumeCatalogGraph can't run: its id names no node of the graph or its subgraphs, names an agent, a component, a human gate or a subgraph (those run on the engine), or is given twice. It also appears when the native engine sent no effect key for the step: keep @ailu-ai/napi at the version of @ailu-ai/graph-sdk.

AILU_WEB_SEARCH_INVALID​

An agent's webSearch cannot be honored as configured: it sits next to tools, the filesystem or memory (the provider's search cannot be mixed with client tools yet), it gives both allowedDomains and blockedDomains, or maxUses is not a positive whole number. Give web search to an agent of its own.

AILU_INVALID_FAN_OUT_LIMITS​

InvalidFanOutLimitsError. Host fanOutLimits contains an unknown field or a value outside its supported positive integer range: maxItems is 1–1,024 (default 128), maxConcurrency is 1–32 (default 8), and maxTotalItems is 1–4,096 (default 512). Settings are checked and copied at runner construction; values are never clamped. safeCompile({ fanOutLimits }) returns the typed error instead of throwing it. Rust exposes FanOutLimitsError, and Python raises InvalidFanOutLimitsError for its fan_out_limits host option.

Configure the host/runtime rather than the saved graph or channel data. Dynamic nesting stays fixed at 8. The total allowance is per start/resume/replay traversal; concurrency is per map, and nested maps receive deterministic shares that can reject work below the total ceiling.

AILU_LEGACY_TS_AGENT_HANDLER​

An agent handler from the removed TypeScript engine was called. Build agents with agentNode and run them with app.run().

Models​

AILU_UNKNOWN_PROVIDER​

UnknownProviderError. A model or a provider option names a provider Ailu doesn't know, such as "groq:llama-3". Use one of openai, anthropic, google, mistral, openrouter, minimax, huggingface, ollama, lmstudio, or model.openaiCompatible({ baseURL }) for any OpenAI-compatible server.

AILU_MISSING_PROVIDER_KEY​

MissingProviderKeyError. model.<provider>(...).invoke() found no key. Set the variable the message names, or AILU_LLM_MOCK=1 to run offline.

AILU_API_KEY_ENV_NOT_ALLOWED​

ApiKeyEnvNotAllowedError, from .invoke() or a graph run. The model's apiKeyEnv names a variable that the host's AILU_API_KEY_ENV_ALLOWLIST does not allow, so it was not read. Name a variable the list allows, or ask the operator to add it. See Models and providers.

AILU_NO_PROVIDER_IN_ENV​

NoProviderInEnvError. A tier-only model (model.fast) found no provider key at all. Set one of the variables in Models and providers, or name a provider.

Messages from the engine​

Some errors come from the engine as plain messages:

Message starts withMeaning
unknown model provider '...'A graph definition names a provider Ailu doesn't know. See AILU_UNKNOWN_PROVIDER.
no API key for provider '...'An agent's provider has no key. Set the variable it names, or AILU_LLM_MOCK=1.
no model provider API key foundA tier-only agent found no key at all.
Ollama is not enabled / LM Studio is not enabledSet AILU_USE_OLLAMA=1 / AILU_USE_LMSTUDIO=1.
condition '...' failedA conditional-edge predicate threw; the run fails rather than guess a branch.
node_input_mismatchA replay reached a plain step (bound with nodes or not) that its recording has no result for: the replay diverged from the recorded run. The step is not called and the replay is refused.
tool_input_mismatchA replayed agent called a tool that its recording has no result for: the replay diverged. The tool is not called.