{"record":{"id":"0a8a3740bcace984","repo":"coleam00/Archon","slug":"failed-to-set-up-github-conversation-please-try","errorCode":null,"errorMessage":"Failed to set up GitHub conversation - please try again","messagePattern":"Failed to set up GitHub conversation - please try again","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapters/src/forge/github/adapter.ts","lineNumber":1127,"sourceCode":"      repoPath,\n      isNew: isNewCodebase,\n    } = await this.getOrCreateCodebaseForRepo(owner, repo);\n\n    // 6b. Link conversation to codebase (fixes #97)\n    if (isNewConversation) {\n      try {\n        await db.updateConversation(existingConv.id, {\n          codebase_id: codebase.id,\n          cwd: repoPath,\n        });\n      } catch (updateError) {\n        if (updateError instanceof ConversationNotFoundError) {\n          getLog().error(\n            { conversationId: existingConv.id, codebaseId: codebase.id },\n            'github.conversation_codebase_link_failed'\n          );\n          // Re-throw as this is a critical setup step\n          throw new Error('Failed to set up GitHub conversation - please try again');\n        }\n        throw updateError;\n      }\n    }\n\n    // 7. Get default branch\n    let defaultBranch: string;\n    try {\n      const { data: repoData } = await this.withTokenRefresh(owner, repo, octokit =>\n        octokit.rest.repos.get({ owner, repo })\n      );\n      defaultBranch = repoData.default_branch;\n    } catch (error) {\n      const err = toError(error);\n      getLog().error({ err, owner, repo, conversationId }, 'github.repo_metadata_fetch_failed');\n      try {\n        const userMessage = classifyAndFormatError(err);\n        await this.sendMessage(conversationId, userMessage);","sourceCodeStart":1109,"sourceCodeEnd":1145,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/adapters/src/forge/github/adapter.ts#L1109-L1145","documentation":"GitHubAdapter setup throws this when linking an existing conversation to its codebase fails with ConversationNotFoundError, meaning the conversation ID referenced during GitHub conversation setup no longer exists in the store. The adapter intentionally re-throws as a generic retryable message because conversation-to-codebase linking is a critical setup step that cannot proceed without it.","triggerScenarios":"During GitHubAdapter setup, updateConversation is called to attach the codebase to the existing conversation and rejects with ConversationNotFoundError — the conversation was deleted, pruned, or belongs to a different store/database.","commonSituations":"Stale conversation ID after database reset or cleanup job; run resumed against a wiped database; concurrent process deleted the conversation; pointing the adapter at a different ARCHON database than the one that created the conversation.","solutions":["Retry the action as the message suggests — if the conversation was transiently missing it may be recreated.","Start a fresh conversation/thread for the repository instead of reusing the stale one.","Verify the server is connected to the same database where the conversation was created (no env drift between instances).","Check for retention/cleanup jobs that delete conversations and inspect logs tagged 'github.conversation_codebase_link_failed' for the conversationId."],"exampleFix":"// before: resuming with stale conversation id from a wiped DB\nadapter.setup({ conversationId: 'conv_deleted' })\n// after: create a new conversation first\nconst conv = await store.createConversation({ codebaseId });\nadapter.setup({ conversationId: conv.id })","handlingStrategy":"try-catch","validationCode":"// Verify the conversation exists before setup\nconst conv = await store.getConversation(conversationId);\nif (!conv) throw new Error(`Conversation ${conversationId} missing; create a new one`);","typeGuard":null,"tryCatchPattern":"try {\n  await adapter.setup({ conversationId, codebaseId });\n} catch (err) {\n  if (err instanceof Error && err.message === 'Failed to set up GitHub conversation - please try again') {\n    // recreate the conversation and retry setup once\n  }\n}","preventionTips":["Pin all components to the same database (avoid env drift).","Re-create conversations after DB resets instead of reusing cached IDs.","Check retention/cleanup jobs before reusing old conversation IDs.","Lookup the conversation in the store before adapter setup."],"tags":["github","conversation","state","setup"],"backgroundTag":"conversation-not-found","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}