Skip to content

Errors

The SDKs raise four error types, so you can branch on the type rather than parse a message. All four extend AuraError, so one catch covers everything.

Type Means Carries
AuraApiError The API rejected the call status, detail
AuraResponseError The server answered, but with something the SDK could not read status when known
AuraTurnCancelledError The turn stopped before finishing the partial content, the conversation id
AuraTurnTimeoutError Your wait elapsed — the turn is still running the conversation id, the elapsed wait

Any non-2xx response. status is the HTTP code; detail is the API’s error body, which is a string for simple errors and an object for structured ones — check before assuming a shape.

import { AuraApiError } from "@strangeworks/aura-sdk";
try {
await aura.getProject(projectId);
} catch (err) {
if (err instanceof AuraApiError) {
if (err.status === 401) throw new Error("key missing or revoked");
if (err.status === 404) return null; // no such project
if (err.status === 429) return retryLater(); // rate limited
}
throw err;
}

AuraResponseError means the call reached Aura and came back, but the body was not what the contract promises — an empty body where one was required, or a payload that is not the JSON it claimed. It is distinct from AuraApiError, which is the API deliberately rejecting you.

status is set only when it is known, so check it rather than assume.

Raised when the turn ended before completing, either because you aborted the wait or because the server marked the reply partial. Whatever the agent produced is attached.

import { AuraTurnCancelledError } from "@strangeworks/aura-sdk";
try {
const reply = await aura.chat(project.id, "Solve this.", { signal });
return reply.content;
} catch (err) {
if (err instanceof AuraTurnCancelledError) {
return err.partialContent ?? "(the agent stopped before writing anything)";
}
throw err;
}
import { AuraTurnTimeoutError } from "@strangeworks/aura-sdk";
try {
return await aura.chat(project.id, "Solve this.", { timeoutMs: 10 * 60_000 });
} catch (err) {
if (err instanceof AuraTurnTimeoutError) {
console.warn(`still running after ${String(err.timeoutMs)}ms`);
await aura.cancel(project.id, err.conversationId); // or keep polling instead
}
throw err;
}

The elapsed wait is in milliseconds in TypeScript (timeoutMs) and seconds in Python (timeout).

import { AuraError } from "@strangeworks/aura-sdk";
try {
await runPipeline();
} catch (err) {
if (err instanceof AuraError) {
console.error(`Aura: ${err.name}: ${err.message}`);
}
throw err;
}

Non-2xx responses print as a plain error message and exit 1. Cancelling a turn with Ctrl-C during aura chat --message stops the turn server-side and exits 130.