toeverything/AFFiNE · error · CopilotPromptNotFound

copilot_prompt_not_found

copilot_prompt_not_found

Error message

Copilot prompt ${name} not found.

What it means

toConversationMetaState rehydrates a stored copilot session and throws CopilotPromptNotFound if the promptName persisted with the session no longer resolves, e.g. the prompt was deleted after the session was created.

Source

Thrown at packages/backend/server/src/plugins/copilot/session.ts:219

  private async toConversationState(
    session: StoredConversation
  ): Promise<ConversationState> {
    const { conversation, prompt } =
      await this.toConversationMetaState(session);

    return {
      conversation,
      turns: session.turns,
      focus: session.focus,
      prompt,
    };
  }

  private async toConversationMetaState(
    session: StoredConversation | StoredConversationMeta
  ): Promise<ConversationMetaState> {
    const prompt = await this.prompts.get(session.promptName);
    if (!prompt) throw new CopilotPromptNotFound({ name: session.promptName });

    return {
      conversation: session.conversation,
      focus: session.focus,
      prompt,
    };
  }

  async getState(sessionId: string): Promise<ConversationState | undefined> {
    const session = await this.store.get(sessionId);
    if (!session) return;

    return await this.toConversationState(session);
  }

  async getMetaState(
    sessionId: string
  ): Promise<ConversationMetaState | undefined> {

View on GitHub (pinned to b4c8548c09)

Solutions

  1. Confirm the prompt name exists via the prompt list API before creating the session.
  2. Fix the prompt name spelling or select one of the built-in prompts.
  3. If the prompt was deleted, recreate it or choose another prompt.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at packages/backend/server/src/plugins/copilot/session.ts:219 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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