apache/seatunnel · error · RuntimeError
Bedrock Mantle stream ended abnormally
Error message
Bedrock Mantle stream ended abnormally: {message} What it means
Raised by chat_stream() when the Mantle Responses stream terminates with a failure-class event (response.failed, response.incomplete, response.error, or a generic error) that carries no response object for _raise_on_terminal_status to interpret. The event's message (or the event type itself) is embedded in the RuntimeError.
Solutions
- Retry the request, ideally with exponential backoff, since many stream failures are transient
- Log the embedded message/etype and check AWS Bedrock service health and quotas
- Catch the RuntimeError around stream iteration and restart the stream from the last received chunk
Example fix
// before
for chunk in provider.chat_stream(messages):
process(chunk)
// after
for attempt in range(3):
try:
for chunk in provider.chat_stream(messages):
process(chunk)
break
except RuntimeError as e:
if "ended abnormally" in str(e) and attempt < 2:
time.sleep(2 ** attempt)
continue
raise Defensive patterns
Strategy: retry
Validate before calling
if not provider:
raise ValueError("provider must be initialized before streaming") Type guard
def is_abnormal_stream_end(e: BaseException) -> bool:
return isinstance(e, RuntimeError) and "ended abnormally" in str(e) Try / catch
for attempt in range(3):
try:
for chunk in provider.chat_stream(messages):
handle(chunk)
break
except RuntimeError as e:
if "ended abnormally" in str(e) and attempt < 2:
time.sleep(2 ** attempt)
else:
raise Prevention
- Always iterate provider streams inside a retry loop with backoff
- Persist received chunks so streams can be resumed after abnormal termination
- Monitor Bedrock service health/quotas when failures cluster
When it happens
Trigger: Streaming via chat_stream() and receiving etype in {"response.failed","response.incomplete","response.error","error"} where event.response is None, so the fallback message = getattr(event, "message", "") or etype path raises.
Common situations: Transient Bedrock service errors during generation; malformed requests rejected mid-stream; throttling or internal model errors surfaced only as stream events.
Understand the failure class
Background: 'Something went wrong' / 'Request failed (500)' / 'HTTP error! status: 404' — what failed HTTP requests actually mean and how to find the real cause — this error's family across 28 libraries.
Related errors
- Bedrock Mantle response ended with status
- Bedrock Mantle model refused the request
- bedrock-mantle provider requires: pip install openai…
- Airtable source connector not support unbounded operation
- ANTHROPIC_API_KEY environment variable is required for…
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/80bf8b14834c08ca.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-cli/seatunnel_cli/llm_provider.py:1244
if item_type == "function_call" and current_tool_id:
yield {"type": "tool_stop", "tool_use_id": current_tool_id}
current_tool_id = None
elif item_type == "reasoning":
yield {
"type": "mantle_responses_item",
"item": self._dump_item(item),
}
elif etype == "response.refusal.done":
refusal = getattr(event, "refusal", "") or ""
raise RuntimeError(
f"Bedrock Mantle model refused the request: {refusal}")
elif etype in ("response.failed", "response.incomplete",
"response.error", "error"):
resp = getattr(event, "response", None)
self._raise_on_terminal_status(resp) if resp is not None \
else None
message = getattr(event, "message", "") or etype
raise RuntimeError(
f"Bedrock Mantle stream ended abnormally: {message}")
elif etype == "response.completed":
self._raise_on_terminal_status(getattr(event, "response", None))
yield {
"type": "message_stop",
"stop_reason": "tool_use" if saw_tool_use else "end_turn",
}
# ─── OrcaRouter Provider ───
class OrcaRouterProvider(OpenAIProvider):
"""OrcaRouter AI gateway provider (OpenAI Chat Completions API).
OrcaRouter is an OpenAI-compatible gateway that exposes many models (and
provider/model routing namespaces) behind one endpoint. Models are
addressed as ``provider/model``, e.g. ``orcarouter/auto`` routes and
grades automatically. Defaults to the ``orcarouter/auto`` model, whichView on GitHub (pinned to cf67b549a7)