toeverything/AFFiNE · error
FRONTEND_DISCONNECTED
FRONTEND_DISCONNECTED
Error message
The focused editor disconnected during the read.
What it means
The realtime connection backing a delegated-tool lease dropped; onDisconnect deletes the lease and fails any pending request bound to that connectionId, so in-flight delegated reads resolve with a structured error reporting the focused editor disconnected.
Source
Thrown at packages/backend/server/src/plugins/copilot/delegated/service.ts:256
@OnEvent('copilot.delegated.tool.responded', { suppressError: true })
onRemoteResponse(event: Events['copilot.delegated.tool.responded']) {
this.receive(event.userId, event.response);
}
@OnEvent('realtime.connection.disconnected', { suppressError: true })
onDisconnect({ connectionId }: Events['realtime.connection.disconnected']) {
for (const [key, lease] of this.leases) {
if (lease.connectionId === connectionId) {
this.leases.delete(key);
}
}
for (const [requestId, request] of this.pending) {
if (request.connectionId !== connectionId) continue;
this.pending.delete(requestId);
request.resolve({
...request.identity,
error: {
code: 'FRONTEND_DISCONNECTED',
message: 'The focused editor disconnected during the read.',
retryable: true,
},
});
this.publisher.publish(
'copilot.delegated.tool.requested',
{ clientId: request.identity.clientId },
{ type: 'cancel', ...request.identity, reason: 'disconnect' },
{
room: realtimeUserRoom(
request.userId,
`copilot:${request.identity.clientId}`
),
}
);
}
}
View on GitHub (pinned to b4c8548c09)
Solutions
- Reconnect the focused editor and retry the read.
- Check the editor session for unexpected termination.
Defensive patterns
Strategy: fallback
When it happens
Trigger: Returned as FRONTEND_DISCONNECTED when the realtime connection of the focused editor drops while a delegated read is pending, resolving the request on disconnect.
Common situations: The app lost connection or the tab closed during a copilot tool call. Reconnect, refocus the document, and retry the operation.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/74fd7d4ad42df7c3.
Report an issue: GitHub.