continuedev/continue · error · Error

No tool use found

Error message

No tool use found

What it means

Thrown during Cohere chat streaming when a 'tool-call-delta' finish reason arrives but no preceding tool_use event set lastToolUseId/lastToolUseName. The streamer cannot construct the toolCall object without knowing which tool the deltas belong to, so it aborts the chat stream.

Source

Thrown at core/llm/llms/Cohere.ts:256

          lastToolUseName = value.delta.message.tool_calls.function.name;
          yield {
            role: "assistant",
            content: "",
            toolCalls: [
              {
                id: lastToolUseId,
                type: "function",
                function: {
                  name: lastToolUseName,
                  arguments: value.delta.message.tool_calls.function.arguments,
                },
              },
            ],
          };
          break;
        case "tool-call-delta":
          if (!lastToolUseId || !lastToolUseName) {
            throw new Error("No tool use found");
          }
          yield {
            role: "assistant",
            content: "",
            toolCalls: [
              {
                id: lastToolUseId,
                type: "function",
                function: {
                  name: lastToolUseName,
                  arguments: value.delta.message.tool_calls.function.arguments,
                },
              },
            ],
          };
          break;
        case "tool-call-end":
          lastToolUseId = undefined;

View on GitHub (pinned to 5522c6f44c)

Solutions

  1. Retry the request; truncated streams often succeed on retry
  2. Check that tool definitions passed to the LLM config have valid, matching names field in each function definition
  3. Pin/upgrade the SDK so the Cohere streaming parser matches the current Cohere API event format
  4. If persistent, disable streaming for tool-using requests or reduce maxTokens pressure that truncates tool-call events
Defensive patterns

Strategy: fallback

Try / catch

try {
  for await (const m of llm.streamChat(msgs, signal, { tools })) { /* ... */ }
} catch (e) {
  if (e instanceof Error && e.message === 'No tool use found') {
    return llm.chat(msgs, { tools }); // fall back to non-streaming
  }
  throw e;
}

Prevention

When it happens

Trigger: Streaming _streamChat/_streamComplete with tools enabled where Cohere emits tool call deltas without a matching tool call start event: truncated stream, model referencing a tool hallucinated mid-delta, or API version returning delta events in an unexpected order.

Common situations: Cohere API version changes to the streaming tool-call event schema, streams cut off mid-tool-call (network drop), or tool definitions with names the model mangles, producing deltas with no initiating event.

Related errors


AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27). Data as JSON: /api/errors/d1c683c24e20391d. Report an issue: GitHub.