{"record":{"id":"72fc66f6555ee7f9","repo":"toeverything/AFFiNE","slug":"frontend-unavailable","errorCode":"FRONTEND_UNAVAILABLE","errorMessage":"No focused editor is available for this session.","messagePattern":"No focused editor is available for this session\\.","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/backend/server/src/plugins/copilot/delegated/service.ts","lineNumber":120,"sourceCode":"      ) {\n        selected = lease;\n      }\n    }\n    return selected;\n  }\n\n  async execute(\n    options: CopilotChatOptions,\n    tool: DelegatedToolName,\n    args: Record<string, unknown>,\n    signal?: AbortSignal,\n    execution?: { runId?: string; toolCallId?: string }\n  ) {\n    const lease = this.getLease(options, tool);\n    if (!lease) {\n      return {\n        error: {\n          code: 'FRONTEND_UNAVAILABLE',\n          message: 'No focused editor is available for this session.',\n          retryable: true,\n        },\n      };\n    }\n    const mode = await this.access.sessionResource(\n      {\n        userId: lease.userId,\n        workspaceId: lease.workspaceId,\n        docId: lease.docId,\n        action: 'Doc.Read',\n      },\n      [lease.sessionId]\n    );\n    if (mode === 'canonical') {\n      await this.ac\n        .user(lease.userId)\n        .workspace(lease.workspaceId)","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/2af30773aecd567f09b346e7b72fc69143144057/packages/backend/server/src/plugins/copilot/delegated/service.ts#L102-L138","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Focus an editor session before invoking the delegated read.","Re-establish the editor connection and retry."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2af30773aecd567f09b346e7b72fc69143144057","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}