skills/copilotkit-debug/references/error-patterns.md
CopilotKitErrorCode)Legacy error codes from the v1 runtime layer. These still surface in @copilotkit/* packages since they wrap v2 internally. Defined in packages/v1/shared/src/utils/errors.ts.
runtimeUrl in CopilotKitProvider. Common sub-causes:
ECONNREFUSED -- Server not running on the expected portENOTFOUND -- DNS cannot resolve the hostnameETIMEDOUT -- Server overloaded or network issuesbasePath in createCopilotEndpoint() matches the runtimeUrl in the provider.CopilotChat agentId and the runtime's agents map. The error message lists available agents.@copilotkit/* packages are on different versions.@copilotkit/* packages are the same version. Run npm ls @copilotkit/runtime @copilotkit/react.publicApiKey prop is missing from CopilotKitProvider when using CopilotKit Cloud.publicApiKey to the provider, or switch to self-hosted mode with runtimeUrl.All defined in packages/v1/shared/src/utils/errors.ts:
| Class | Extends | When Thrown |
|---|---|---|
CopilotKitError | GraphQLError | Base class for all structured errors |
CopilotKitMisuseError | CopilotKitError | Wrong usage of components/hooks |
CopilotKitVersionMismatchError | CopilotKitError | Package version incompatibility |
CopilotKitApiDiscoveryError | CopilotKitError | Runtime endpoint not found (404, routing) |
CopilotKitRemoteEndpointDiscoveryError | CopilotKitApiDiscoveryError | Remote agent endpoint unreachable |
CopilotKitAgentDiscoveryError | CopilotKitError | Named agent not in registry |
CopilotKitLowLevelError | CopilotKitError | Pre-HTTP errors (DNS, connection refused) |
ResolvedCopilotKitError | CopilotKitError | HTTP error responses (status-code based) |
ConfigurationError | CopilotKitError | Invalid configuration |
MissingPublicApiKeyError | ConfigurationError | Cloud mode without API key |
UpgradeRequiredError | ConfigurationError | Plan limitation |
CopilotKitCoreErrorCode)Used by @copilotkit/core. Defined in packages/v2/core/src/core/core.ts. These are emitted via the onError subscriber callback.
/info endpoint returned an error or was unreachable.runtimeUrl points to a running CopilotRuntime. Check CORS if cross-origin. The /info endpoint must return agent metadata and runtime version.wsUrl) is correct. For SSE mode, check that the agent exists in the runtime.RunFailedEvent (the agent explicitly signaled failure).RunErrorEvent (non-fatal error during the run).execute handler threw an exception.onError.useFrontendTool is registered with the correct name before the agent runs.agentId passed to CopilotChat or useAgent does not match any agent in the runtime./info endpoint to see available agents. Match the agentId prop.transcriptionService configured in the runtime.TranscriptionErrorCode)Used by @copilotkit/shared and @copilotkit/react. Defined in packages/v2/shared/src/transcription-errors.ts.
| Code | Retryable | Description |
|---|---|---|
service_not_configured | No | No transcription service in runtime |
invalid_audio_format | No | Unsupported audio format |
audio_too_long | No | Audio file exceeds maximum duration |
audio_too_short | No | Audio too short to transcribe |
rate_limited | Yes | Provider rate limit hit |
auth_failed | No | Provider authentication failed |
provider_error | Yes | Provider returned an error |
network_error | Yes | Network failure during transcription |
invalid_request | No | Malformed request to transcription endpoint |
PlatformRequestError)Used by @copilotkit/runtime for Intelligence mode. Defined in packages/v2/runtime/src/intelligence-platform/client.ts.
| Status | Meaning |
|---|---|
| 404 | Thread not found |
| 409 | Thread already exists (race condition -- handled automatically by getOrCreateThread) |
| 401 | Invalid API key or tenant ID |
| 500 | Platform server error |
These are frequently reported bugs from the CopilotKit issue tracker:
copilotkit_emit_message, copilotkit_emit_state, copilotkit_emit_tool_call never reach the frontend"copilotkit_" prefix but ag-ui-langgraph expects names without the prefixag-ui-langgraph or patch the event name mappingdefineTool tool calls fail without error or responseREASONING_* events in the AG-UI SSE stream are not handled correctlyuseFrontendTool with renderAndWaitForResponse does not execute after user confirmsrunId consistency (related: #3456)LangChainAdapter throws "Unknown provider undefined" in v1.50.0+provider/model properties hit a code path that assumes they existBuiltInAgent or add .provider/.model to the adapterBadRequestError when mixing frontend and backend tools with LangGraphCannot read properties of null (reading 'subscribe') during A2A integration@ai-sdk/openai-compatible