{"record":{"id":"d1c683c24e20391d","repo":"continuedev/continue","slug":"no-tool-use-found","errorCode":null,"errorMessage":"No tool use found","messagePattern":"No tool use found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"core/llm/llms/Cohere.ts","lineNumber":256,"sourceCode":"          lastToolUseName = value.delta.message.tool_calls.function.name;\n          yield {\n            role: \"assistant\",\n            content: \"\",\n            toolCalls: [\n              {\n                id: lastToolUseId,\n                type: \"function\",\n                function: {\n                  name: lastToolUseName,\n                  arguments: value.delta.message.tool_calls.function.arguments,\n                },\n              },\n            ],\n          };\n          break;\n        case \"tool-call-delta\":\n          if (!lastToolUseId || !lastToolUseName) {\n            throw new Error(\"No tool use found\");\n          }\n          yield {\n            role: \"assistant\",\n            content: \"\",\n            toolCalls: [\n              {\n                id: lastToolUseId,\n                type: \"function\",\n                function: {\n                  name: lastToolUseName,\n                  arguments: value.delta.message.tool_calls.function.arguments,\n                },\n              },\n            ],\n          };\n          break;\n        case \"tool-call-end\":\n          lastToolUseId = undefined;","sourceCodeStart":238,"sourceCodeEnd":274,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/core/llm/llms/Cohere.ts#L238-L274","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Retry the request; truncated streams often succeed on retry","Check that tool definitions passed to the LLM config have valid, matching names field in each function definition","Pin/upgrade the SDK so the Cohere streaming parser matches the current Cohere API event format","If persistent, disable streaming for tool-using requests or reduce maxTokens pressure that truncates tool-call events"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  for await (const m of llm.streamChat(msgs, signal, { tools })) { /* ... */ }\n} catch (e) {\n  if (e instanceof Error && e.message === 'No tool use found') {\n    return llm.chat(msgs, { tools }); // fall back to non-streaming\n  }\n  throw e;\n}","preventionTips":["Fall back to non-streaming chat when tool streaming fails","Keep tool names valid and consistently defined","Retry once: truncated tool streams are often transient"],"tags":["cohere","streaming","tool-call","chat"],"backgroundTag":"streaming-tool-call-parse-error","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}