openai/codex · error · RequestError

thread usage response did not contain requested thread {thre

Error message

thread usage response did not contain requested thread {thread_id}

What it means

Error "thread usage response did not contain requested thread {thread_id}" thrown in openai/codex.

Source

Thrown at codex-rs/backend-client/src/client/thread_usage.rs:68

        let url = self.thread_usage_url();
        let request = self
            .request(Method::POST, &url)
            .headers(self.headers())
            .header(CONTENT_TYPE, HeaderValue::from_static("application/json"))
            .json(&ThreadUsageQueryRequest {
                thread_ids: [thread_id],
            });
        let (body, content_type) = self.exec_request_detailed(request, "POST", &url).await?;
        let response = self
            .decode_json::<ThreadUsageQueryResponse>(&url, &content_type, &body)
            .map_err(RequestError::from)?;

        response
            .threads
            .into_iter()
            .find(|usage| usage.thread_id == thread_id)
            .ok_or_else(|| {
                RequestError::from(anyhow!(
                    "thread usage response did not contain requested thread {thread_id}"
                ))
            })
    }

    fn thread_usage_url(&self) -> String {
        match self.path_style {
            PathStyle::CodexApi => {
                format!("{}/api/codex/usage/thread_usage/query", self.base_url)
            }
            PathStyle::ChatGptApi => {
                format!("{}/wham/usage/thread_usage/query", self.base_url)
            }
        }
    }
}

#[cfg(test)]

View on GitHub (pinned to 339751715c)

When it happens

Trigger: Thrown at codex-rs/backend-client/src/client/thread_usage.rs:68 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of openai/codex@339751715c (2026-08-25). Data as JSON: /api/errors/ffbc04fcc99e6e53. Report an issue: GitHub.