Skip to content

fix: retry transient OpenAI JSON parse errors in batch completion - #1011

Open
jonaserb-k wants to merge 1 commit into
mainfrom
fix/retry-transient-openai-json-parse-error
Open

fix: retry transient OpenAI JSON parse errors in batch completion#1011
jonaserb-k wants to merge 1 commit into
mainfrom
fix/retry-transient-openai-json-parse-error

Conversation

@jonaserb-k

@jonaserb-k jonaserb-k commented Mar 27, 2026

Copy link
Copy Markdown
Collaborator

What This PR Does

  • OpenAI's API intermittently returns a spurious "could not parse the JSON body" 400 error on valid requests
  • With large benchmarks (e.g. 940 samples), this causes nearly every run to fail despite the error being transient
  • Adds per-item retry logic: after batch_completion, any item that failed with this specific error is retried individually up to 3 times
  • Other BadRequestError types (genuinely malformed requests) are not retried

How to trust this PR

  • Verified fix on multiple MLLM eval benchmarks (quilt_vqa_ffqa, pcam_mcqa, etc.) with openai/gpt-5-4
  • Confirmed retries are triggered and succeed (visible in job logs as WARNING)
  • Confirmed runs that previously failed consistently now complete successfully

OpenAI's API intermittently returns "could not parse the JSON body"
BadRequestError on valid requests. This causes entire benchmark runs
to fail despite the error being transient. Add per-item retry logic
that detects this specific error and retries the individual failed
request up to 3 times, allowing the batch to complete successfully.
@jonaserb-k
jonaserb-k force-pushed the fix/retry-transient-openai-json-parse-error branch from 7f905e3 to efa265e Compare March 27, 2026 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant