clockworklabs/SpacetimeDB · error · InvalidOperationException

Reducer result for unknown request_id {reducerResult.Request

Error message

Reducer result for unknown request_id {reducerResult.RequestId}

What it means

Every reducer call is tracked client-side in pendingReducerCalls under a request id. When a ReducerResult arrives whose request id is not in that map, the parse thread throws InvalidOperationException. The parse loop's catch-all logs the exception, fails pending operations and disconnects, so users see this as a dropped connection with the message in the log.

Source

Thrown at sdks/csharp/src/SpacetimeDBClient.cs:553

                        {
                            try
                            {
                                reducerEvent = new(
                                    (DateTimeOffset)reducerResult.Timestamp,
                                    reducerStatus,
                                    Identity ?? throw new InvalidOperationException("Identity not set"),
                                    ConnectionId,
                                    null,
                                    pendingReducer.Reducer);
                            }
                            catch (Exception)
                            {
                                // The local reducer request still completed; failure here should not block update apply.
                            }
                        }
                        else
                        {
                            throw new InvalidOperationException(
                                $"Reducer result for unknown request_id {reducerResult.RequestId}"
                            );
                        }
                        break;
                    case ServerMessage.ProcedureResult(var procedureResult):
                        procedureEvent = new ProcedureEvent(
                            procedureResult.Timestamp,
                            procedureResult.Status,
                            Identity ?? throw new InvalidOperationException("Identity not set"),
                            ConnectionId,
                            procedureResult.TotalHostExecutionDuration,
                            procedureResult.RequestId
                        );

                        if (!stats.ProcedureRequestTracker.FinishTrackingRequest(procedureResult.RequestId, unparsed.timestamp))
                        {
                            Log.Warn($"Failed to finish tracking procedure request: {procedureResult.RequestId}");
                        }

View on GitHub (pinned to 524b4487d9)

Solutions

  1. Update the C# SDK to the version matching your server release
  2. After a disconnect, build a fresh connection via a new builder rather than resuming the old one
  3. Implement OnDisconnect handling that reconnects with backoff so the desync recovers automatically
  4. If it reproduces on matched versions, attach full client logs and file a SpacetimeDB issue
Defensive patterns

Strategy: retry

Prevention

When it happens

Trigger: Server/client desync of the request-id space: a reconnect while the server still had in-flight reducer calls, duplicated or replayed ReducerResult delivery, or SDK/server version mismatch changing protocol bookkeeping.

Common situations: Custom reconnect logic re-driving one DbConnection after a network blip; flaky mobile networks causing duplicate frames; preview-channel server against a released SDK.

Related errors


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/c75ba21fb9911ea6. Report an issue: GitHub.