toeverything/AFFiNE · error · RequestTimeoutError

RequestTimeout

RequestTimeout

Error message

Request timeout

What it means

Raised as RequestTimeoutError when the AI SSE event source neither delivers a message nor closes within the configured timeout while awaiting the next message and the signal is not aborted. Means the AI backend stopped streaming.

Source

Thrown at packages/frontend/core/src/blocksuite/ai/provider/event-source.ts:89

        } else {
          resolveMessagePromise();
        }
        eventSource.close();
      });

      try {
        while (
          eventSource.readyState !== EventSource.CLOSED &&
          !signal?.aborted
        ) {
          if (messageQueue.length === 0) {
            // Wait for the next message or timeout
            await (timeout
              ? Promise.race([
                  messagePromise,
                  delay(timeout).then(() => {
                    if (!signal?.aborted) {
                      throw new RequestTimeoutError();
                    }
                  }),
                ])
              : messagePromise);
          } else if (messageQueue.length > 0) {
            const top = messageQueue.shift();
            if (top) {
              yield top;
            }
          }
        }
      } finally {
        eventSource.close();
      }
    },
  };
}

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Retry the request with a longer timeout or check network connectivity.
  2. Increase the event-source timeout if the server legitimately responds slowly.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown as RequestTimeoutError in the AI event source stream loop when no message arrives within the configured timeout and the request was not aborted.

Common situations: Occurs when an AI streaming request stalls due to a slow or unresponsive server. Check network connectivity and retry the AI action.

Understand the failure class


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/97af5d4b1ba9e262. Report an issue: GitHub.