Skip to content

Cannot read properties of undefined (reading 'prompt_tokens') #256

@gempir

Description

@gempir

I see this error frequently when an agent is done with a task and done with it, and then it seems to fail with that.

This was on version 0.2.1 but also on other versions. I'm using OpenCode Go but I've seen this error on other providers aswell.

2026-02-27T22:26:12.363363Z ERROR worker.run: spacebot::agent::worker: message=worker LLM call 
failedworker_id=48c8bdfe-6fec-4017-b9f9-2526556af813
error=CompletionError: ProviderError: OpenAI API error (500 Internal Server Error): Cannot read properties of undefined (reading 'prompt_tokens') 
worker_id=48c8bdfe-6fec-4017-b9f9-2526556af813
channel_id=twitch:nymn
task=Write a 2000 word scientific paper about Reed-Solomon encoding. The paper should be structured like an academic paper with the following sections:
2026-02-27T22:26:12.363465Z ERROR spacebot::agent::channel: message=worker 
failedworker_id=48c8bdfe-6fec-4017-b9f9-2526556af813
error=CompletionError: ProviderError: OpenAI API error (500 Internal Server Error): Cannot read properties of undefined (reading 'prompt_tokens')

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions