dapr/dapr · error
flush MCP servers: %w
Error message
flush MCP servers: %w
What it means
Raised while waiting for outstanding MCP server initializations: processor.Flush — the barrier over the shared root loop that resolves when every in-flight init completes — returned an error. Either a pending MCP server (or a component/HTTPEndpoint co-scheduled on the same root loop) failed to init, or the context was canceled before the drain finished.
Source
Thrown at pkg/runtime/mcpservers.go:98
return nil
case err := <-ch:
if err == nil {
return nil
}
err = fmt.Errorf("process MCPServer %s error: %s", s.Name, err)
if s.Spec.IgnoreErrors {
log.Errorf("Ignoring error processing MCPServer: %s", err)
return nil
}
log.Warnf("Error processing MCPServer, daprd will exit gracefully: %s", err)
return err
}
}
func (a *DaprRuntime) flushOutstandingMCPServers(ctx context.Context) error {
log.Info("Waiting for all outstanding MCP servers to be processed…")
if err := a.processor.Flush(ctx); err != nil {
return fmt.Errorf("flush MCP servers: %w", err)
}
log.Info("All outstanding MCP servers processed")
return nil
}
View on GitHub (pinned to 74ad417027)
Solutions
- Inspect the init errors logged just before this line to identify the failing MCP server and fix its spec/auth
- Delay applying MCP servers (or add readiness ordering) until target endpoints and secrets exist
- Increase terminationGracePeriodSeconds if the failure happens at shutdown drain
- Remove the offending MCPServer resource and restart daprd
Example fix
# before: MCP server applied before the target endpoint exists # after: init container / Helm hook waits for the endpoint startupProbe / preHook: curl -fsS https://mcp.example.com/health
Defensive patterns
Strategy: validation
Validate before calling
# pre-flight: target MCP endpoints answer before daprd starts for url in $(kubectl get mcpservers -n <ns> -o json | jq -r '.items[].spec.serverUrl? // empty'); do curl -fsS --max-time 5 "$url" || echo "not ready: $url"; done
Try / catch
if err := rt.flushOutstandingMCPServers(ctx); err != nil && errors.Is(err, context.Canceled) { /* graceful-shutdown drain cut short: extend grace period */ } Prevention
- Apply MCP servers only after target endpoints and secrets are ready
- Keep terminationGracePeriodSeconds larger than slowest MCP client construction
- Monitor ComponentInitFailed metrics to catch failing resources before flush
When it happens
Trigger: flushOutstandingMCPServers runs during daprd startup/shutdown; it fails when an MCP server init errors (auth failure, unreachable server) or ctx is canceled (shutdown timeout) while inits are still pending.
Common situations: An MCP server pointing at an endpoint that is not yet up blocks the flush; shutdown grace period shorter than slow MCP client construction; concurrent failing components on the shared root loop surfacing through this wrap.
Related errors
- flush http endpoints: %w
- process MCPServer %s error: %s
- server is closed
- flush components: %w
- failed to deserialize MCPServer: %w
AI-assisted analysis of dapr/dapr@74ad417027 (2026-08-16).
Data as JSON: /api/errors/050f3f4693acf600.
Report an issue: GitHub.