ERROR goose::agents::truncate: Error: Execution error: No usage data in response
After a couple of iterations with goose I'm starting constantly getting the error:
ERROR goose::agents::truncate: Error: Execution error: No usage data in response
at crates/goose/src/agents/truncate.rs:256
Ran into this error: Execution error: No usage data in response.
Please retry if you think this is a transient or recoverable error.
Provider: Claude-3-5 through OpenRouter Version: 1.0.0
Exiting / Restoring the session does not help, only creating a new session can fix it for me.
this is the error you're seeing: https://github.com/block/goose/blob/7e534a0b971eb9abbb5099d03a94435160f69c47/crates/goose/src/agents/truncate.rs#L254-L259
and i believe it's coming from here where we try to get the usage data from open router response: https://github.com/block/goose/blob/7e534a0b971eb9abbb5099d03a94435160f69c47/crates/goose/src/providers/openrouter.rs#L206
i think what might be happening (not sure) is that OpenRouter passes a different response usage object depending on provider https://openrouter.ai/docs/responses#response-body docs: If the provider returns usage, we pass it down as-is. Otherwise, we count using the GPT-4 tokenizer.
can you share the response for simple curl command to chat complete using Claude-3-5 through OpenRouter?
It is a playground project, so I think I can share logs of the session.
I found this in goose session logs:
2025-01-29T13:50:44.416299Z DEBUG mcp_client::transport::stdio: Sending outgoing message, Request(JsonRpcRequest { jsonrpc: "2.0", id: Some(26), method: "tools/call", params: Some(Object {"arguments": Object {"command": String("view"), "path": String("/var/home/sem/github/pyspark-explain/tests/resources/simple_filter_schema.json")}, "name": String("text_editor")}) })
at crates/mcp-client/src/transport/stdio.rs:122
2025-01-29T13:50:44.417240Z DEBUG mcp_client::transport::stdio: Received incoming message, Response(JsonRpcResponse { jsonrpc: "2.0", id: Some(26), result: Some(Object {"content": Array [Object {"annotations": Object {"audience": Array [String("assistant")]}, "resource": Object {"mime_type": String("text"), "text": String("{\n \"fields\": [\n {\n \"name\": \"value\",\n \"type\": \"StringType()\",\n \"nullable\": true\n }\n ]\n}"), "uri": String("file:///var/home/sem/github/pyspark-explain/tests/resources/simple_filter_schema.json")}, "type": String("resource")}, Object {"annotations": Object {"audience": Array [String("user")], "priority": Number(0.0)}, "text": String("### /var/home/sem/github/pyspark-explain/tests/resources/simple_filter_schema.json\n```json\n{\n \"fields\": [\n {\n \"name\": \"value\",\n \"type\": \"StringType()\",\n \"nullable\": true\n }\n ]\n}\n```\n"), "type": String("text")}]}), error: None })
at crates/mcp-client/src/transport/stdio.rs:85
2025-01-29T13:50:44.417487Z DEBUG goose::agents::capabilities: input: "{\"name\":\"developer__text_editor\",\"arguments\":{\"command\":\"view\",\"path\":\"/var/home/sem/github/pyspark-explain/tests/resources/simple_filter_schema.json\"}}", output: "{\"Ok\":[{\"type\":\"resource\",\"resource\":{\"uri\":\"file:///var/home/sem/github/pyspark-explain/tests/resources/simple_filter_schema.json\",\"mime_type\":\"text\",\"text\":\"{\\n \\\"fields\\\": [\\n {\\n \\\"name\\\": \\\"value\\\",\\n \\\"type\\\": \\\"StringType()\\\",\\n \\\"nullable\\\": true\\n }\\n ]\\n}\"},\"annotations\":{\"audience\":[\"assistant\"]}},{\"type\":\"text\",\"text\":\"### /var/home/sem/github/pyspark-explain/tests/resources/simple_filter_schema.json\\n```json\\n{\\n \\\"fields\\\": [\\n {\\n \\\"name\\\": \\\"value\\\",\\n \\\"type\\\": \\\"StringType()\\\",\\n \\\"nullable\\\": true\\n }\\n ]\\n}\\n```\\n\",\"annotations\":{\"audience\":[\"user\"],\"priority\":0.0}}]}"
at crates/goose/src/agents/capabilities.rs:505
in goose::agents::capabilities::dispatch_tool_call
in goose::agents::truncate::reply
2025-01-29T13:51:04.609931Z ERROR goose::agents::truncate: Error: Execution error: No usage data in response
at crates/goose/src/agents/truncate.rs:256
in goose::agents::truncate::reply
Can it help?
Which model are you using exactly? I'm not able to reproduce on my end when using openrouter and the anthropic/claude-3.5-sonnet model.
I'm using:
"model": {
"model_name": "anthropic/claude-3.5-sonnet",
"tokenizer_name": "Xenova--claude-tokenizer",
"context_limit": 200000,
"temperature": null,
"max_tokens": null
}
(it is from the log)
I replaced my api_key by "*" symbol in the log and I'm attaching the whole log to the message. The log is big (20 Mb), I cannot easily find the root of the problem. By the error I mentioned is easy to find by Ctrl + F -> "rs:256", there are three appearance of that error in the log I attached.
Thanks for the logs! Seems like a possibly transient issue with OpenRouter as they suggest in their docs that every response should have a usage field, but evidently seems like that isn't always the case! Added a fix here to just emit a warning trace if this happens instead of erroring and failing to return the response: https://github.com/block/goose/pull/907
@SemyonSinchenko we will release to stable tomorrow. you can try pulling the latest cli (from canary).
curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh | CANARY=true bash
please let us know if that solves it
@salman1993 Thanks a lot! It looks like everything is fine from now! I worked in a session for an hour and did not get the mentioned error. Before the fix, I was getting this error about every 10-15 minutes. Thanks a lot!
I know this is closed, but I am also getting this error constantly, after ~10 minutes of using Goose. Doesn't matter what I'm doing, it happens on OpenAI, Anthropic, and OpenRouter. Seems like a random amount of time, then this;
YYYY-MM-DD ERROR goose::agents::truncate: Error: Execution error: No usage data in response
at crates/goose/src/agents/truncate.rs:256
Ran into this error: Execution error: No usage data in response.
Please retry if you think this is a transient or recoverable error.
Installing latest with curl -fsSL https://github.com/block/goose/releases/download/stable/download_cli.sh | CANARY=true bash does not fix it.
[Updated]
I take that back. A new error on the canary download, after I type "retry" or "continue" in a previous session.
WARN goose::providers::openrouter: Failed to get usage data: No usage data in response
at crates/goose/src/providers/openrouter.rs:211
@HunterR0se thanks for the feedback! That's actually expected behavior for the warning to be admitted but it shouldn't interfere with your session conversation. If it's distracting/annoying though we could remove it and only emit a debug trace that gets written to the log.
@HunterR0se thanks for the feedback! That's actually expected behavior for the warning to be admitted but it shouldn't interfere with your session conversation. If it's distracting/annoying though we could remove it and only emit a debug trace that gets written to the log.
Problem is, it does interfere. It completely stops output on the cli;
2025-02-02T04:19:32.510074Z WARN goose::providers::openrouter: Failed to get usage data: No usage data in response
at crates/goose/src/providers/openrouter.rs:211
( O)>
@HunterR0se thanks for the feedback! That's actually expected behavior for the warning to be admitted but it shouldn't interfere with your session conversation. If it's distracting/annoying though we could remove it and only emit a debug trace that gets written to the log.
Problem is, it does interfere. It completely stops output on the cli;
2025-02-02T04:19:32.510074Z WARN goose::providers::openrouter: Failed to get usage data: No usage data in response at crates/goose/src/providers/openrouter.rs:211 ( O)>
Oh interesting - what was output before the warn message? And you're not able to send another message after?
Any message I send just repeats the error. I have to exit and create a new session.
If I go into the .toml session file and delete the last few lines, with the [] values, it continues.
But, this effectively means I get stuck when the .toml file is too large, regardless of the ai I'm using.
After some time I'm starting to get the error again. The only thing that works is to go to the session file and manually delete the last line with [] as @HunterR0se suggested.
@salman1993 @ahau-square cc
I encountered a similar issue but not due to the usage field.
In my logs I found:
output={ "error": { "code": 502, "message": "Overloaded", "metadata": { "provider_name": "Anthropic", "raw": { "message": "Overloaded", "type": "overloaded_error" } } }
This is when I tried to process a really large file through OpenRouter. Sounds similar to the issue you're having with the large .toml file @HunterR0se . At the very least we're not propagating this kind of error correctly up.
Could you share your .toml file that causes the issue?
My session is stored in .jsonl instead of .toml
{"role":"user","created":1738590927,"content":[{"Text":{"text":"Now I'm getting this error in CI for scala 2.12: \" [error] java.lang.NoSuchMethodError: scala.tools.nsc.Global.reporter()Lscala/tools/nsc/reporters/Reporter;\n[error] \tat scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:119)\""}}]}
{"role":"assistant","created":1738590940,"content":[]}
{"role":"user","created":1738590979,"content":[{"Text":{"text":"Now I'm getting this error in CI for scala 2.12: \" [error] java.lang.NoSuchMethodError: scala.tools.nsc.Global.reporter()Lscala/tools/nsc/reporters/Reporter;\n[error] \tat scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:119)\""}}]}
{"role":"assistant","created":1738590997,"content":[{"Text":{"text":"This error is a common compatibility issue between Scala compiler versions and scoverage versions. Let's analyze the situation:\n\n1. We're running with Scala 2.12.12 in CI (from the matrix)\n2. The error suggests incompatibility between the Scala compiler and scoverage plugin\n\nFor Scala 2.12, especially 2.12.12, we need to be very careful with the scoverage version. Let's check the recommended version matrix.\n\nIn this case, for projects that need to support both Scala 2.12.12 and 2.13.8, the most compatible scoverage version would be 1.6.1. This version was widely used with both Scala versions and doesn't have the reporter method incompatibility.\n\nUpdate `project/plugins.sbt` to:\n```scala\naddSbtPlugin(\"org.scoverage\" % \"sbt-scoverage\" % \"1.6.1\")\naddSbtPlugin(\"com.github.sbt\" % \"sbt-release\" % \"1.1.0\")\naddSbtPlugin(\"com.eed3si9n\" % \"sbt-assembly\" % \"2.1.5\")\n```\n\nThis version:\n1. Works well with both Scala 2.12.12 and 2.13.8\n2. Doesn't have the reporter method incompatibility\n3. Was widely used in the Spark ecosystem\n4. Is compatible with sbt 1.x\n\nThe newer versions of scoverage (2.x series) have made some assumptions about the Scala compiler API that don't work well with older Scala versions, which is why we're seeing the `NoSuchMethodError`. Going back to 1.6.1 should resolve this issue while maintaining compatibility with both Scala versions and not requiring any CI modifications.\n\nThis is a common pattern in Scala ecosystem where supporting multiple Scala versions sometimes requires using older plugin versions that have better cross-version compatibility."}}]}
{"role":"user","created":1738593680,"content":[{"Text":{"text":"Now I'm getting this error in CI for scala 2.12: \" [error] java.lang.NoSuchMethodError: scala.tools.nsc.Global.reporter()Lscala/tools/nsc/reporters/Reporter;\n[error] \tat scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:119)\". The version of scoverage plugin in CI is 1.6.1 as difened in project/plugins.sbt. What can cause it?"}}]}
{"role":"assistant","created":1738593694,"content":[]}
For some reason I did not see an answer "created":1738590997 in CLI: I saw only a warning:
( O)> Now I'm getting this error in CI for scala 2.12: " [error] java.lang.NoSuchMethodError: scala.tools.nsc.Global.reporter()Lscala/tools/nsc/reporters/Reporter;
[error] at scoverage.ScoverageInstrumentationComponent$$anon$1.run(plugin.scala:119)". The version of scoverage plugin in CI is 1.6.1 as difened in
project/plugins.sbt. What can cause it?
◐ Gathering digital breadcrumbs... 2025-02-03T14:41:34.894566Z WARN goose::providers::openrouter: Failed to get usage data: No usage data in response
at crates/goose/src/providers/openrouter.rs:209
This has become literally infuriating and is now near constant.
Invalid parameters: Could not interpret tool use parameters for id toolu_01MMatWj8Th7Vryic57vTCu7: EOF while parsing an object at line 1 column 1188
◒ Untangling spaghetti code...
2025-02-06T01:00:12.780061Z WARN goose::providers::openrouter: Failed to get usage data: No usage data in response
at crates/goose/src/providers/openrouter.rs:211
( O)> continue
◐ Weaving wisdom web...
2025-02-06T01:00:35.298073Z WARN goose::providers::openrouter: Failed to get usage data: No usage data in response
at crates/goose/src/providers/openrouter.rs:211
This is on a NEW SESSION with a very small amount of text in the request, not an existing large session.
I'm obviously using OpenRouter. Using Anthropic or any other system causes nearly immediate failures due to token use, because, even on Tier 4, goose uses so many tokens so fast that the system starts giving me API limitations after just a few queries.
Example:
ERROR goose::agents::truncate: Error: Rate limit exceeded: Some(Object {"error": Object {"message": String("This request would exceed your organization’s rate limit of 160,000 input tokens per minute. For details, refer to: https://docs.anthropic.com/en/api/rate-limits; see the response headers for current usage. Please reduce the prompt length or the maximum tokens requested, or try again later. You may also contact sales at https://www.anthropic.com/contact-sales to discuss your options for a rate limit increase."), "type": String("rate_limit_error")}, "type": String("error")})
at crates/goose/src/agents/truncate.rs:279
This is after two queries.
@HunterR0se which extensions are you using? The issue here you just mentioned is probably with OpenRouter or the model you're using through them (Invalid parameters: Could not interpret tool use parameters for id toolu_01MMatWj8Th7Vryic57vTCu7: EOF while parsing an object at line 1 column 1188). This is possibly due to the parameters generated by the model somehow not conforming to the tool spec.
The no usage found warning is generated when no usage parameter is found, but it doesn't interrupt Goose's execution. It can be indicative though that some other kind of model/provider error occurred which caused a failure to generate a response (hence no usage data found).