Skip to content

Errors

What the clients raise when the daemon is away, misconfigured, or returns an error.

1 min read36 pages in SDK Reference

On this page2
import { Compozy } from "@compozy/client";

API errors

The daemon returned an HTTP error. Secrets and request headers are never retained.

Signature
class CompozyApiError extends Error

Options

statusnumber
codestring
The daemon's code, or http_<status> when it sent none.
detailsunknown
currentTurnIdstring | undefined
The daemon's current_turn_id, when present.

message is the daemon's error or message, or the HTTP status text.

Example
import { CompozyApiError } from "@compozy/client";

try {
  await compozy.tasks.listTasks({ query: { status: "in_progress" } });
} catch (error) {
  if (error instanceof CompozyApiError) {
    console.error(error.status, error.code, error.message, error.details);
  } else {
    throw error;
  }
}

Connection and stream errors

Each client reports an unreachable daemon, an invalid configuration, and a broken stream with its own error.

Signature
class CompozyUnavailableError extends Error
class CompozyConfigError extends Error
class CompozyStreamError extends Error
class CompozyBinaryNotFoundError extends Error

Connection failures raise CompozyUnavailableError; invalid discovery configuration raises CompozyConfigError. Malformed event data and an interrupted prompt stream raise CompozyStreamError. Compozy.start() raises CompozyBinaryNotFoundError when it cannot find the compozy binary.