toeverything/AFFiNE · error

FRONTEND_UNAVAILABLE

FRONTEND_UNAVAILABLE

Error message

No focused editor is available for this session.

What it means

execute() could not obtain a delegated-tool lease because no focused editor client is attached to this session; without a live editor there is no frontend to run the delegated read, so a structured FRONTEND_UNAVAILABLE tool error (retryable) is returned to the model instead of throwing.

Source

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

      ) {
        selected = lease;
      }
    }
    return selected;
  }

  async execute(
    options: CopilotChatOptions,
    tool: DelegatedToolName,
    args: Record<string, unknown>,
    signal?: AbortSignal,
    execution?: { runId?: string; toolCallId?: string }
  ) {
    const lease = this.getLease(options, tool);
    if (!lease) {
      return {
        error: {
          code: 'FRONTEND_UNAVAILABLE',
          message: 'No focused editor is available for this session.',
          retryable: true,
        },
      };
    }

    const identity = {
      requestId: randomUUID(),
      runId: execution?.runId ?? randomUUID(),
      toolCallId: execution?.toolCallId ?? randomUUID(),
      sessionId: lease.sessionId,
      workspaceId: lease.workspaceId,
      docId: lease.docId,
      clientId: lease.clientId,
      editorStateId: lease.editorStateId,
    };
    const deadlineAt = Date.now() + TOOL_TIMEOUT_MS;
    const response = new Promise<DelegatedToolResponse>(resolve => {

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Focus an editor session before invoking the delegated read.
  2. Re-establish the editor connection and retry.
Defensive patterns

Strategy: retry

When it happens

Trigger: Returned as FRONTEND_UNAVAILABLE when getLease finds no active editor lease for the session, so there is no focused editor to delegate the tool call to.

Common situations: A copilot delegated tool runs while no document is open or focused in the client. Focus an editor in the app and retry; the error is retryable.


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