Skip to content

Intermittent NotFoundError (404) on Batch APIΒ #1432

@AlgoApi

Description

@AlgoApi

πŸ› Intermittent NotFoundError (404) on Batch API β€” server-side propagation delay

Summary

After successfully creating a message batch, subsequent calls to batches.retrieve() and/or batches.results() intermittently return 404 Not Found. Based on production logs, this appears to be a transient server-side propagation delay across Anthropic infrastructure nodes β€” not a client error. All affected batches eventually completed successfully.


Observed behaviors

Three distinct failure cases were observed within the same ~15-minute window (20:41–20:57 UTC+3, 2026-04-21), suggesting a wider infrastructure issue during that period.


Case 1 β€” batches.retrieve() returns 404 seconds after successful creation

A batch is created successfully, but the very first retrieve() call (within 1–2 seconds) returns 404. Subsequent polls succeed and the batch completes normally.

Timeline:

20:55:43 β€” batches.create()    β†’ 200 OK  (batch_id=msgbatch_01RQCg3J...)
20:55:44 β€” batches.retrieve()  β†’ 404     ← only 1 second after creation
20:56:24 β€” batches.retrieve()  β†’ in_progress βœ“
20:57:44 β€” batches.retrieve()  β†’ 404     ← transient again
20:58:24 β€” batches.retrieve()  β†’ ended βœ“
            batches.results()  β†’ 200 OK βœ“

Case 2 β€” batches.results() returns 404 after status was confirmed as ended

retrieve() previously returned ended. The next retrieve() returns 404 (transient). Then results() is called with the same batch ID and also returns 404, crashing the application.

Note: internally results() calls retrieve() once more before fetching the result stream β€” that internal retrieve() is what triggers the crash.

Full traceback
File "/app/AI_processor.py", in query_claude_batch
    results_decoder = await claude_client.messages.batches.results(batch.id)
File ".../anthropic/resources/messages/batches.py", line 616, in results
    batch = await self.retrieve(message_batch_id=message_batch_id)
File ".../anthropic/_base_client.py", line 1781, in request
    raise self._make_status_error_from_response(err.response) from None
anthropic.NotFoundError: Error code: 404 - {
  'type': 'error',
  'error': {'type': 'not_found_error', 'message': 'Not Found'},
  'request_id': 'req_011CaHa7WHy2cjXQgr8JYT7T'
}

Case 3 β€” batches.create() itself returns 404

The POST endpoint for creating a new batch returns 404, preventing the batch from being created entirely.

Full traceback
File "/app/AI_processor.py", in query_claude_batch
    batch = await retry_async(...batches.create(requests=[request]))
File ".../anthropic/resources/messages/batches.py", line 383, in create
    return await self._post(...)
File ".../anthropic/_base_client.py", line 1781, in request
    raise self._make_status_error_from_response(err.response) from None
anthropic.NotFoundError: Error code: 404 - {
  'type': 'error',
  'error': {'type': 'not_found_error', 'message': 'Not Found'},
  'request_id': 'req_011CaHatjLHyAs3U4XTyL62Q'
}

Expected behavior

Method Expected Actual
batches.create() 200 OK for a valid request 404 Not Found
batches.retrieve(id) 200 OK for an existing batch 404 Not Found seconds after creation
batches.results(id) stream results for an ended batch 404 Not Found

Environment

  • SDK: anthropic (version: 0.96.0)
  • Python: 3.11
  • Client: AsyncAnthropic
  • Date of occurrence: 2026-04-21, ~20:41–20:57 UTC+3

All three request_id values share the prefix req_011CaH... β€” may help correlate on your side.


Workaround

Failure point Workaround applied
batches.retrieve() β†’ 404 Treat as transient, continue polling (next poll succeeds)
batches.results() β†’ 404 Catch NotFoundError, fall back to messages.create()
batches.create() β†’ 404 Catch NotFoundError, fall back to messages.create()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions