google-gemini/gemini-cli · error
[A2AClientManager] sendMessageStream Error [${agentName}]: U
Error message
[A2AClientManager] sendMessageStream Error [${agentName}]: Unexpected error during sendMessageStream: ${String(error)} What it means
Sibling of error 175 from the same catch block, fired when the thrown value is *not* an `Error` instance (e.g. a string, number, or plain object). The manager stringifies it and wraps with the same prefix so the traceability is preserved even for non-Error throws from the underlying client or transport.
Source
Thrown at packages/core/src/agents/a2a-client-manager.ts:228
kind: 'message',
role: 'user',
messageId: uuidv4(),
parts: [{ kind: 'text', text: message }],
contextId: options?.contextId,
taskId: options?.taskId,
},
};
try {
yield* client.sendMessageStream(messageParams, {
signal: options?.signal,
});
} catch (error: unknown) {
const prefix = `[A2AClientManager] sendMessageStream Error [${agentName}]`;
if (error instanceof Error) {
throw new Error(`${prefix}: ${error.message}`, { cause: error });
}
throw new Error(
`${prefix}: Unexpected error during sendMessageStream: ${String(error)}`,
);
}
}
/**
* Retrieves a loaded agent card.
* @param name The name of the agent.
* @returns The agent card, or undefined if not found.
*/
getAgentCard(name: string): AgentCard | undefined {
return this.agentCards.get(name);
}
/**
* Retrieves a loaded client.
* @param name The name of the agent.
* @returns The client, or undefined if not found.View on GitHub (pinned to 5024443c72)
Solutions
- Inspect `String(error)` in the message to recover whatever the underlying layer threw.
- Wrap any custom transport/fetch in a layer that converts non-Error throws into `new Error(String(e))` before they reach sendMessageStream.
- If you control the client, always throw Error instances.
- Treat the message text as a diagnostic and route the original cause through logging for triage.
Example fix
// before — custom fetch rejects with a string
const fetchImpl = () => Promise.reject('timeout');
// after — wrap to Error
const fetchImpl = () =>
Promise.reject(new Error('timeout')); Defensive patterns
Strategy: try-catch
Try / catch
try {
for await (const r of manager.sendMessageStream(name, msg)) {}
} catch (e) {
// e.message embeds String(originalError) — log it for triage
logger.error({ message: (e as Error).message });
// wrap your transport so future throws are Error instances
} Prevention
- Wrap any custom transport/fetch so its rejections are always Error instances.
- Log the full message text — non-Error causes lose fidelity otherwise.
- Audit third-party A2A clients for non-Error throws during evaluation.
When it happens
Trigger: The A2A client (or a custom fetch/transport injected via auth) throws a non-Error value — a string message, a plain object, or a rejected promise with a non-Error payload. This is the fallback branch of `error instanceof Error ? ... : ...`.
Common situations: A third-party transport that does `throw 'timeout'` instead of `throw new Error('timeout')`; a fetch shim rejecting with a Response object; an older JS library that throws strings; a serialization layer that strips the Error prototype.
Related errors
- [A2AClientManager] sendMessageStream Error [${agentName}]: $
- A2AClient getTask Error [${agentName}]: Unexpected error: ${
- A2AClient getTask Error [${agentName}]: ${error.message}
- A2AClient cancelTask Error [${agentName}]: Unexpected error:
- RemoteSubagentProtocol: A2AClientManager not available for '
AI-assisted analysis of google-gemini/gemini-cli@5024443c72 (2026-08-12).
Data as JSON: /api/errors/63dd9db2b640e030.
Report an issue: GitHub.