{"record":{"id":"b9834f52a537aace","repo":"toeverything/AFFiNE","slug":"copilot-prompt-not-found-b9834f","errorCode":"copilot_prompt_not_found","errorMessage":"Copilot prompt ${name} not found.","messagePattern":"Copilot prompt (.+?) not found\\.","errorType":"exception","errorClass":"CopilotPromptNotFound","httpStatus":404,"severity":"error","filePath":"packages/backend/server/src/plugins/copilot/session.ts","lineNumber":219,"sourceCode":"  private async toConversationState(\n    session: StoredConversation\n  ): Promise<ConversationState> {\n    const { conversation, prompt } =\n      await this.toConversationMetaState(session);\n\n    return {\n      conversation,\n      turns: session.turns,\n      focus: session.focus,\n      prompt,\n    };\n  }\n\n  private async toConversationMetaState(\n    session: StoredConversation | StoredConversationMeta\n  ): Promise<ConversationMetaState> {\n    const prompt = await this.prompts.get(session.promptName);\n    if (!prompt) throw new CopilotPromptNotFound({ name: session.promptName });\n\n    return {\n      conversation: session.conversation,\n      focus: session.focus,\n      prompt,\n    };\n  }\n\n  async getState(sessionId: string): Promise<ConversationState | undefined> {\n    const session = await this.store.get(sessionId);\n    if (!session) return;\n\n    return await this.toConversationState(session);\n  }\n\n  async getMetaState(\n    sessionId: string\n  ): Promise<ConversationMetaState | undefined> {","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/backend/server/src/plugins/copilot/session.ts#L201-L237","documentation":"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.","triggerScenarios":"Thrown at packages/backend/server/src/plugins/copilot/session.ts:219 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the prompt name exists via the prompt list API before creating the session.","Fix the prompt name spelling or select one of the built-in prompts.","If the prompt was deleted, recreate it or choose another prompt."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}