Errors
The errors the Agents SDK throws and when.
import { RuntimeError } from "@nylorun/agents";
try {
await session.input(text, { idempotencyKey });
} catch (error) {
if (error instanceof RuntimeError && error.status === 409) {
// the same idempotencyKey with different content
}
throw error;
}Client errors
| Class | Thrown when | Fields |
|---|---|---|
RuntimeError | The Runtime answers with an error status | status, body |
IncompatibleRuntimeError | The Runtime's protocol is outside the client's range, or lacks a feature the call needs | compatibility, remedy, host |
ConnectionError | createClient() finds no connection | code |
RuntimeError.body is the Runtime's JSON error. Each endpoint page lists the
statuses it answers with; Troubleshooting explains
the common codes.
Definition errors
| Class | Thrown when | Fields |
|---|---|---|
AgentBuildError | An agent definition is invalid | diagnostics |
WorkflowBuildError | A flow is invalid | diagnostics |
McpError | An MCP server is invalid, such as a stdio server | code |
SkillsError | A skills folder cannot be loaded | code, diagnostics |
PluginError | A plugin package cannot be loaded | code, diagnostics |