Skip to content

Start typing to search the documentation.

Errors Reference

Last updated View as Markdown

Flue exposes stable machine-readable error categories through its public transports. Runtime operations, workflow records, CLI commands, development servers, and builds also report failures, but not every surface uses the transport error vocabulary.

Public transport errors

FluePublicError

interface FluePublicError {
  type: string;
  message: string;
  details: string;
  dev?: string;
  meta?: Record<string, unknown>;
}

Caller-safe error details exposed by Flue transports. Unknown failures become a generic internal_error payload without leaking their original message. Branch on type, not message prose.

FieldMeaning
typeStable machine-readable error category.
messageShort caller-facing summary.
detailsCaller-facing explanation.
devAdditional local development guidance when available.
metaStructured error-specific metadata when available. For example, validation issue details.

dev is omitted unless the runtime has additional guidance and is running locally. Node.js flue dev and flue run enable it with FLUE_MODE=local. Cloudflare Vite development enables it only in development-server mode; preview and production builds render the production envelope.

Categories

The following categories are stable for framework-owned transport failures. HTTP responses use the listed status code.

TypeHTTP statusMeaning
method_not_allowed405The endpoint does not accept the request method. HTTP responses include Allow.
unsupported_media_type415A request body was not sent as JSON.
invalid_json400A request body could not be read or parsed as JSON.
agent_not_found404The requested agent is not registered or not exposed through the requested transport.
workflow_not_found404The requested workflow is not registered or not exposed over HTTP.
route_not_found404No generated default-application route matches the request.
run_not_found404The workflow run is missing, expired, or not owned by the resolved workflow instance.
stream_not_found404The agent-instance event stream does not exist yet; agent streams are created on first admitted prompt.
run_store_unavailable501The runtime does not provide workflow-run storage, lookup, or listing.
invalid_request400The request shape, parameters, or protocol message is invalid. Read details for the specific reason.
internal_error500An unknown or non-public server failure occurred.

Transport envelopes

SurfaceEnvelope
Framework HTTP error response{ error: FluePublicError }
Durable Streams invalid-query or missing-stream response{ error: FluePublicError }

Durable Streams reads use the same framework envelope for invalid query parameters and missing streams. A stream may still terminate through transport behavior rather than a JSON error body, such as a client disconnect during SSE.

See Events Reference for runtime event types.

Workflow-run streams

Workflow failures normally appear in a terminal run_end event with isError: true.

Workflow-run and operation failures

Workflow-run records, run_end events, and operation events expose open-ended error?: unknown values. Runtime exceptions are commonly serialized as { name, message } when recorded. These failure records are structured observation data, not a closed list of machine-readable transport categories.

Runtime exceptions

FlueError

class FlueError extends Error {
  readonly type: string;
  readonly details: string;
  readonly dev: string;
  readonly meta?: Record<string, unknown>;
}

The catchable base class for framework-thrown runtime failures, exported from @flue/runtime. Application code distinguishes Flue failures from arbitrary errors with instanceof FlueError, then narrows with the concrete subclasses below or the stable type field. Message, details, and dev strings are human-readable prose, not API.

Runtime errors

Harness and session operations, and runtime provider registration, reject with typed FlueError subclasses, all importable from @flue/runtime:

ClasstypeThrown when
SessionNotFoundErrorsession_not_foundsessions.get() targets a session that does not exist.
SessionAlreadyExistsErrorsession_already_existssessions.create() targets a session that already exists.
SessionBusyErrorsession_busyAn operation starts, or deletion is requested, while another operation is running.
SessionDeletedErrorsession_deletedAn operation targets a deleted session.
SkillNotRegisteredErrorskill_not_registeredA skill call or activation names a skill that is not registered.
ModelNotConfiguredErrormodel_not_configuredA model operation runs with no call-level or agent-level model configured.
TaskDepthExceededErrortask_depth_exceededNested task() delegation exceeds the supported depth.
SubagentNotDeclaredErrorsubagent_not_declaredtask() names a subagent the agent does not declare.
ToolNameConflictErrortool_name_conflictCustom or sandbox adapter tool names collide with each other or with framework-reserved names.
ToolInputValidationErrortool_input_validationModel-supplied tool arguments fail the tool’s valibot parameters schema. The agent loop converts the throw into an error tool result so the model can retry; meta.issues carries the failures in Standard Schema’s issues shape.
OperationFailedErroroperation_failedAn operation ran but did not complete successfully (for example, the model call errored).
SubmissionTimeoutErrorsubmission_timeoutA durable submission exceeded its configured processing timeout.
ProviderRegistrationErrorinvalid_provider_registrationregisterProvider() targets a non-catalog provider id without api and baseUrl.

When one of these errors escapes to an HTTP transport (for example, a synchronous ?wait=result invocation), the response body carries the error’s typed envelope with status 500 instead of the generic internal_error payload.

ResultUnavailableError

class ResultUnavailableError extends Error {
  readonly reason: string;
  readonly assistantText: string;
}

Thrown when an agent cannot produce a required structured result, either because it gives up or does not finish after follow-up attempts. Import it from @flue/runtime when application logic needs to handle that outcome separately.

Cancellation

Aborted prompt, skill, task, and shell operations reject with a standard AbortError (DOMException) carrying the abort reason as cause when the runtime permits it. Cancellation is deliberately not part of the FlueError vocabulary.

Authoring and definition-time validation failures, such as invalid agent profiles, tool definitions, dispatch payloads, or model ids, reject with human-readable Error messages. Those messages are not stable machine-readable categories.

CLI, build, and development diagnostics

CLI diagnostics are human-oriented messages written to stderr. They do not currently expose stable machine-readable error codes.

SurfaceDiagnostic families
CLI argumentsUnsupported flags, missing values, invalid targets, and invalid JSON payloads.
ConfigurationMissing or invalid flue.config.* files, invalid default exports, unsupported fields, missing target, and environment files.
BuildMissing source modules, invalid or duplicate source names, generated module exports, imported skills, and target requirements.
Cloudflare buildWrangler availability, compatibility settings, reserved bindings, target packages, and filename constraints.
flue dev initial buildReports the build failure and exits.
flue dev rebuildReports the rebuild failure and keeps watching for a later fix.

Use the actionable diagnostic prose when resolving these errors. Do not parse it as a stable API. See flue build and flue dev for command behavior.

Application-owned responses

An authored app.ts owns its request pipeline. Custom routes and middleware may return arbitrary statuses and bodies, including authorization responses. Flue does not impose an unauthorized transport category on application-owned responses.

Stability boundary

SurfaceContract
FluePublicError fields and documented categoriesStable public transport contract.
Exported FlueError subclasses and their type fieldsStable public runtime contract.
Workflow-run records, workflow events, and operation eventsStructured but open-ended failure data.
Runtime exception messages and CLI, configuration, build messagesHuman-oriented diagnostics subject to refinement.
Generated target internalsImplementation details, not public transport categories.