siyuan-note/siyuan · error
response failed
Error message
response failed
What it means
responseEventError builds the most specific error available from a failed stream event: event.Error first, then event.Response.Error, then event.Message. The fallback string "response failed" appears only for a response.failed event that carried none of these — the response object itself failed (safety system, server error) but the provider sent no detail, so the adapter can only report the event type.
Source
Thrown at kernel/util/openai_completion.go:649
item, ok := responseOutputItem(raw)
if ok && item.Type == "function_call" {
return true
}
}
return false
}
func responseEventError(event openai.ResponseStreamEvent, fallback string) error {
if event.Error != nil && event.Error.Message != "" {
return &openai.APIError{Code: event.Error.Code, Message: event.Error.Message}
}
if event.Response != nil && event.Response.Error != nil && event.Response.Error.Message != "" {
return &openai.APIError{Code: event.Response.Error.Code, Message: event.Response.Error.Message}
}
if event.Message != "" {
return &openai.APIError{Code: event.Code, Message: event.Message}
}
return errors.New(fallback)
}
func (stream *OpenAICompletionStream) ResponseOutput() []json.RawMessage {
return CloneOpenAIResponseOutput(stream.responseOutput)
}
func (stream *OpenAICompletionStream) Close() {
if stream.chat != nil {
stream.chat.Close()
}
if stream.responses != nil {
stream.responses.Close()
}
}
View on GitHub (pinned to afa823b6b4)
Solutions
- Capture the raw SSE frame to confirm the event truly lacks detail.
- Check the provider's server-side logs at that timestamp — the root cause usually lives there.
- Retry with backoff — payload-less failures are frequently transient upstream faults.
- Upgrade or fix the gateway to populate error.code and error.message on failure events.
Defensive patterns
Strategy: retry
Try / catch
Close the stream, surface a generic 'provider failed the response' message, and retry with backoff; if failures cluster, check provider status and logs before retrying further.
Prevention
- Prefer providers that attach error payloads to failure events
- Keep gateway error-mapping configured for upstream faults
- Rate-limit retries on detail-less failures
When it happens
Trigger: Streaming a Responses completion when the provider emits response.failed with an empty or absent error object; upstream server faults converted by the gateway into payload-less failure events.
Common situations: Gateways that collapse upstream 5xx into bare failure events; provider safety terminations without messages; capacity or moderation terminations during long generations.
Related errors
- response stream ended before a terminal event
- response stream terminal event is missing response
- response stream failed
- AI editor stream idle timeout
- streamed function call is missing from the terminal response
AI-assisted analysis of siyuan-note/siyuan@afa823b6b4 (2026-08-18).
Data as JSON: /api/errors/fa18b162be76aa02.
Report an issue: GitHub.