skills/copilotkit-debug/references/quick-workflows.md
The client shows a connection error, banner error, or the chat never loads.
curl -v http://localhost:3001/api/copilotkit/info
createCopilotEndpoint({ basePath }) vs the URL you are hitting.<CopilotKitProvider runtimeUrl="/api/copilotkit">
runtimeUrl match the runtime's basePath exactly?/infoCopilotKitErrorCodenpm ls @copilotkit/runtime @copilotkit/react @copilotkit/core @ag-ui/client
All @copilotkit/* packages should be the same version. Mismatches cause VERSION_MISMATCH errors.
Default CORS allows all origins without credentials. If you need credentials:
createCopilotEndpoint({
runtime,
basePath: "/api/copilotkit",
cors: {
origin: "https://your-frontend.com",
credentials: true,
},
});
And on the client:
<CopilotKitProvider
runtimeUrl="https://your-api.com/api/copilotkit"
credentials="include"
/>
The chat connects but messages are never answered, or the agent returns an error.
curl http://localhost:3001/api/copilotkit/info | jq '.agents'
Check that the agent name matches the agentId prop in CopilotChat or useAgent.
/agent/:agentId/runLook at the SSE events in the response:
Only RunStartedEvent then nothing -> Agent is stalled. Check server logs. Common causes:
RunErrorEvent present -> Read the error message. Common causes:
RunFinishedEvent without text messages -> Agent completed but produced no output. Check the agent's prompt and logic.
For BuiltInAgent, verify the environment variable:
| Provider | Environment Variable |
|---|---|
| OpenAI | OPENAI_API_KEY |
| Anthropic | ANTHROPIC_API_KEY |
GOOGLE_API_KEY | |
| Vertex | Application Default Credentials |
new BuiltInAgent({
model: "openai/gpt-4o", // Must be "provider/model-name"
});
Invalid model strings throw Error: Invalid model string "..." or Error: Unknown provider "...".
The SSE response handler logs errors with full stack traces:
Error running agent: <error>
Error stack: <stack trace>
Error details: { name, message, cause }
The agent starts responding but the stream cuts off, duplicates events, or corrupts messages.
RunFinishedEvent? If not:
RunErrorEvent before the cutoffabort signal cleaned up the streamEvents must follow a logical sequence:
TextMessageStart before TextMessageChunk before TextMessageEndToolCallStart before ToolCallArgs before ToolCallEndRunStarted at the beginning, RunFinished at the endIf events are out of order, the issue is in the agent's Observable implementation.
If the same message appears multiple times:
runId changed mid-conversation. Check for HITL issues (issue #3456).If message content is garbled or mixed:
Content-Type: text/event-stream and is UTF-8| Platform | Default SSE Timeout | Notes |
|---|---|---|
| Vercel (Serverless) | 30s (Hobby), 60s (Pro) | Use Edge Runtime or Intelligence mode |
| Vercel (Edge) | 30s | Better but still limited |
| Railway | 5 min | Usually sufficient |
| Render | 5 min | Usually sufficient |
| Self-hosted | No limit | Depends on reverse proxy config |
For long agent runs, consider:
A frontend tool registered with useFrontendTool is not being called or not returning results.
Check that the tool is registered before the agent runs:
useFrontendTool({
name: "get_weather", // Must match exactly what the agent calls
description: "Get weather",
parameters: z.object({ city: z.string() }),
execute: async ({ city }) => {
/* ... */
},
});
Look for ToolCallStartEvent in the SSE stream:
ToolCallResultEvent -> The frontend did not respond. Check:
useFrontendTool mounted?execute handler throw? (Check tool_handler_failed error)If tool_argument_parse_failed error appears:
ToolCallArgsEvent for the raw argumentsFor renderAndWaitForResponse tools:
runId may change after HITL resolve (issue #3456)Voice input fails or produces errors.
const runtime = new CopilotRuntime({
agents: {
/* ... */
},
transcriptionService: myTranscriptionService, // Must be provided
});
If not configured, the error code is service_not_configured (HTTP 503).
/info responsecurl http://localhost:3001/api/copilotkit/info | jq '.audioFileTranscriptionEnabled'
Should be true. If false, the transcription service is not configured.
AudioRecorderError: "Microphone permission denied" -> User denied permissionAudioRecorderError: "No microphone found" -> No microphone hardware detectedauth_failed -> API key is invalid or expiredrate_limited -> Too many requests, wait and retryprovider_error -> Provider-side issue, check provider status pageinvalid_audio_format -> Browser sends unsupported formataudio_too_long / audio_too_short -> Recording duration out of boundsIf the issue is unresolved after following these workflows:
Check the CopilotKit GitHub Issues: Search https://github.com/CopilotKit/CopilotKit/issues for your error message or symptom.
Enable the Web Inspector: Add <CopilotKitWebInspector /> to capture detailed event traces.
Collect a diagnostic bundle:
npm ls @copilotkit/*)/info responseFile a GitHub issue: https://github.com/CopilotKit/CopilotKit/issues/new with the diagnostic bundle.
Reach out to the CopilotKit team: Book time with the CopilotKit team via their Discord (https://discord.gg/copilotkit) or contact support for urgent production issues.