CopilotKit/CopilotKit · error · Error
Unknown message in metaEvents copilot resolver
Error message
Unknown message in metaEvents copilot resolver
What it means
While streaming meta events in the generateCopilotResponse resolver, an event message of an unrecognized type reaches the dispatch chain and falls through all known cases, throwing this internal invariant error.
Source
Thrown at packages/runtime/src/v1-deprecated/graphql/resolvers/copilot.resolver.ts:355
) {
return plainToInstance(TextMessage, {
id: message.id,
createdAt: new Date(),
content: [(message as TextMessage).content],
role: (message as TextMessage).role,
status: new SuccessMessageStatus(),
});
}
if ("arguments" in message) {
return plainToInstance(ActionExecutionMessage, {
name: message.name,
id: message.id,
arguments: [JSON.stringify(message.arguments)],
createdAt: new Date(),
status: new SuccessMessageStatus(),
});
}
throw new Error(
"Unknown message in metaEvents copilot resolver",
);
}),
},
}),
);
break;
}
},
error: (err) => {
// For structured CopilotKit errors, set proper error response status
if (
err?.name?.includes("CopilotKit") ||
err?.extensions?.visibility
) {
responseStatus$.next(
new UnknownErrorResponse({
description: err.message || "Agent error occurred",View on GitHub (pinned to 68fbe97d87)
Solutions
- Align all @copilotkit/* packages to the same version (clean reinstall of node_modules)
- Remove custom code that injects non-standard messages into metaEvents
- Reproduce with a minimal agent and report/upgrade — this is an internal invariant, not a config knob
Defensive patterns
Strategy: try-catch
Try / catch
try { for await (const evt of stream) { /* ... */ } } catch (e) { if (e instanceof Error && e.message.includes("metaEvents copilot resolver")) { logger.error("runtime version skew suspected", e); } throw e; } Prevention
- Keep all @copilotkit/* packages on identical versions
- Avoid injecting custom messages into internal event streams
When it happens
Trigger: A new or unexpected message type inside metaEvents during response streaming — usually version skew between emitted event payloads and the resolver's switch, or a malformed injected event.
Common situations: Mixing runtime package versions after a partial upgrade; custom code injecting extra messages into the event stream; bugs in the deprecated v1 resolver.
Related errors
- Cannot convert message with role ${message.role} to ResultMe
- Unknown message type
- Unknown message role
- Cannot extract agent name from message with role ${message.r
- Unknown message type
AI-assisted analysis of CopilotKit/CopilotKit@68fbe97d87 (2026-08-27).
Data as JSON: /api/errors/25de19f74c67e755.
Report an issue: GitHub.