Exception: Anthropic::APIResponse::ConsumedBodyError
- Inherits:
-
Errors::Error
- Object
- StandardError
- Errors::Error
- Anthropic::APIResponse::ConsumedBodyError
- Defined in:
- lib/anthropic/middleware.rb
Overview
Raised when a middleware returns an Anthropic::APIResponse whose body enumerator was already consumed without first calling #buffer!. The SDK cannot parse a drained, unbuffered body. Fix by calling ‘res.buffer!` (or `res.parse`) before reading, or by using `res.wrap_body` to transform the stream without consuming it.