toeverything/AFFiNE · error
Selected sources cannot be synchronized
Error message
Selected sources cannot be synchronized
What it means
Guard in waitForSelectedSources fired when the AIRequestService was constructed without a syncSelectedSources callback, so selected doc sources can never be synchronized with the copilot backend. Indicates a wiring/misconfiguration of the AI request service, not a user error.
Source
Thrown at packages/frontend/core/src/blocksuite/ai/runtime/request/service.ts:64
context(): string;
};
private activeEditorGeneration = 0;
private activeEditorActivation = Promise.resolve();
private lastActionSessionId = '';
private readonly actionHistory: {
action: AIActionId;
options: AIActionOptions;
}[] = [];
readonly actionEvents$ = new Subject<AIRequestActionEvent>();
constructor(
readonly client: CopilotClientType,
private readonly syncSelectedSources?: (docIds: string[]) => Promise<void>
) {}
async waitForSelectedSources(docIds: string[]) {
if (!this.syncSelectedSources) {
throw new Error('Selected sources cannot be synchronized');
}
let timeout: ReturnType<typeof setTimeout> | undefined;
try {
await Promise.race([
this.syncSelectedSources(docIds),
new Promise<never>((_, reject) => {
timeout = setTimeout(
() =>
reject(new Error('Selected source synchronization timed out')),
15000
);
}),
]);
} finally {
if (timeout) clearTimeout(timeout);
}
}
View on GitHub (pinned to b4c8548c09)
Solutions
- Re-select the sources and retry; the previous selection became stale.
- Refresh the document/source list before synchronizing.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown in AIRequestService.waitForSelectedSources when no syncSelectedSources callback was provided, so user-selected documents cannot be synced to the server before the AI request.
Common situations: Appears when the AI chat panel is used in a context where source synchronization is not wired up. Ensure the service is constructed with a syncSelectedSources implementation.
AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18).
Data as JSON: /api/errors/802fff25a6651a6e.
Report an issue: GitHub.