toeverything/AFFiNE · error

FRONTEND_TIMEOUT

FRONTEND_TIMEOUT

Error message

The focused editor did not respond before the deadline.

What it means

The published delegated tool request was not answered by the focused editor within TOOL_TIMEOUT_MS; the timeout timer resolves the interrupted promise with a FRONTEND_TIMEOUT structured error so execute() returns a retryable failure to the model rather than hanging.

Source

Thrown at packages/backend/server/src/plugins/copilot/delegated/service.ts:156

      });
    });
    this.publisher.publish(
      'copilot.delegated.tool.requested',
      { clientId: lease.clientId },
      { type: 'request', ...identity, tool, args, deadlineAt },
      { room: realtimeUserRoom(lease.userId, `copilot:${lease.clientId}`) }
    );

    let reason: 'aborted' | 'timeout' | undefined;
    let timeout: ReturnType<typeof setTimeout> | undefined;
    let abort: (() => void) | undefined;
    const interrupted = new Promise<DelegatedToolResponse>(resolve => {
      timeout = setTimeout(() => {
        reason = 'timeout';
        resolve({
          ...identity,
          error: {
            code: 'FRONTEND_TIMEOUT',
            message: 'The focused editor did not respond before the deadline.',
            retryable: true,
          },
        });
      }, TOOL_TIMEOUT_MS);
      timeout.unref?.();
      abort = () => {
        reason = 'aborted';
        resolve({
          ...identity,
          error: {
            code: 'ABORTED',
            message: 'The delegated read was cancelled.',
            retryable: false,
          },
        });
      };
      if (signal?.aborted) {

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Retry the delegated read; reduce the requested range if the editor is slow.
  2. Check the focused editor is responsive.
Defensive patterns

Strategy: retry

When it happens

Trigger: Returned as FRONTEND_TIMEOUT when the delegated request is published but the focused editor does not answer within TOOL_TIMEOUT_MS.

Common situations: The client was busy, asleep, or on a slow connection when the copilot requested a delegated read. Retry the action once the editor is responsive.


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