fix(core): consider code: context_length_exceeded as context overflow in API call errors (#17748)

This commit is contained in:
Johannes Loher
2026-03-16 16:25:24 +01:00
committed by GitHub
parent 15b27e0d18
commit e718db624f
2 changed files with 22 additions and 1 deletions

View File

@@ -167,7 +167,8 @@ export namespace ProviderError {
export function parseAPICallError(input: { providerID: ProviderID; error: APICallError }): ParsedAPICallError {
const m = message(input.providerID, input.error)
if (isOverflow(m) || input.error.statusCode === 413) {
const body = json(input.error.responseBody)
if (isOverflow(m) || input.error.statusCode === 413 || body?.error?.code === "context_length_exceeded") {
return {
type: "context_overflow",
message: m,