Bug
When Anthropic returns a 500 with {"type":"error","error":{"type":"api_error","message":"Internal server error"}}, the fallover mechanism doesn't trigger even though fallbacks are configured.
Root Cause
classifyFailoverReason checks error patterns but none match this error:
isTransientHttpError — requires raw string to start with a numeric HTTP status (/^(?:http\s*)?(\d{3})/). Anthropic's JSON payload doesn't match.
isOverloadedErrorMessage — checks for overloaded_error, overloaded, service unavailable, high demand. api_error / Internal server error doesn't match any.
Expected Behavior
"Internal server error" and "type": "api_error" should be classified as transient/overloaded errors and trigger the configured fallback chain.
Suggested Fix
Add to ERROR_PATTERNS.overloaded:
"internal server error",
/"type"\s*:\s*"api_error"/i,
Or add a dedicated check in classifyFailoverReason for JSON-wrapped API errors that extracts the HTTP-equivalent status.
Config
{
"agents": {
"defaults": {
"model": {
"primary": "anthropic/claude-opus-4-6",
"fallbacks": ["anthropic/claude-sonnet-4-6", "openai/gpt-5.2"]
}
}
}
}
Impact
4 consecutive API 500 errors killed an agent session with zero useful output. Fallbacks were never attempted. Discovered in production with openclaw agent CLI spawned sessions.
Version
OpenClaw 2026.2.21-2 (35a57bc)
Bug
When Anthropic returns a 500 with
{"type":"error","error":{"type":"api_error","message":"Internal server error"}}, the fallover mechanism doesn't trigger even though fallbacks are configured.Root Cause
classifyFailoverReasonchecks error patterns but none match this error:isTransientHttpError— requires raw string to start with a numeric HTTP status (/^(?:http\s*)?(\d{3})/). Anthropic's JSON payload doesn't match.isOverloadedErrorMessage— checks foroverloaded_error,overloaded,service unavailable,high demand.api_error/Internal server errordoesn't match any.Expected Behavior
"Internal server error"and"type": "api_error"should be classified as transient/overloaded errors and trigger the configured fallback chain.Suggested Fix
Add to
ERROR_PATTERNS.overloaded:Or add a dedicated check in
classifyFailoverReasonfor JSON-wrapped API errors that extracts the HTTP-equivalent status.Config
{ "agents": { "defaults": { "model": { "primary": "anthropic/claude-opus-4-6", "fallbacks": ["anthropic/claude-sonnet-4-6", "openai/gpt-5.2"] } } } }Impact
4 consecutive API 500 errors killed an agent session with zero useful output. Fallbacks were never attempted. Discovered in production with
openclaw agentCLI spawned sessions.Version
OpenClaw 2026.2.21-2 (35a57bc)