{"record":{"id":"357a2e36cd0e089a","repo":"coleam00/Archon","slug":"failed-to-sync-repository-to-defaultbranch-try-357a2e","errorCode":null,"errorMessage":"Failed to sync repository to ${defaultBranch}. Try /reset or check if the branch exists. Details: ${syncResult.error.code === 'branch_not_found' ? `Branch '${defaultBranch}' not found` : 'message' in syncResult.error ? syncResult.error.message : syncResult.error.code}","messagePattern":"Failed to sync repository to (.+?)\\. Try /reset or check if the branch exists\\. Details: (.+?)' not found` : 'message' in syncResult\\.error \\? syncResult\\.error\\.message : syncResult\\.error\\.code\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapters/src/forge/github/adapter.ts","lineNumber":711,"sourceCode":"        getLog().error({ repoPath, errorCode: err.code, err }, 'github.repo_path_access_failed');\n        throw new Error(\n          `Cannot access repository at ${repoPath}: ${err.code ?? err.message}. ` +\n            'Check permissions and disk health.'\n        );\n      }\n      // ENOENT means directory doesn't exist - we'll clone below\n    }\n\n    if (directoryExists) {\n      if (shouldSync) {\n        getLog().info({ repoPath, defaultBranch }, 'github.repo_syncing');\n        const syncResult = await syncRepository(toRepoPath(repoPath), toBranchName(defaultBranch));\n        if (!syncResult.ok) {\n          getLog().error(\n            { error: syncResult.error, repoPath, defaultBranch },\n            'github.repo_sync_failed'\n          );\n          throw new Error(\n            `Failed to sync repository to ${defaultBranch}. ` +\n              `Try /reset or check if the branch exists. Details: ${syncResult.error.code === 'branch_not_found' ? `Branch '${defaultBranch}' not found` : 'message' in syncResult.error ? syncResult.error.message : syncResult.error.code}`\n          );\n        }\n      }\n      return;\n    }\n\n    // Directory doesn't exist - clone the repository\n    getLog().info({ owner, repo, repoPath }, 'github.repo_cloning');\n\n    // Create project structure (source/, worktrees/, artifacts/, logs/) before\n    // cloning so worktree paths resolve correctly on first webhook clone.\n    await ensureProjectStructure(owner, repo);\n\n    // Resolve the right auth token per mode. App mode talks to the auth\n    // provider (installation token, ~1h validity); PAT mode reads env directly.\n    let ghToken: string | undefined;","sourceCodeStart":693,"sourceCodeEnd":729,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/adapters/src/forge/github/adapter.ts#L693-L729","documentation":"Error \"Failed to sync repository to ${defaultBranch}. Try /reset or check if the branch exists. Details: ${syncResult.error.code === 'branch_not_found' ? `Branch '${defaultBranch}' not found` : 'message' in syncResult.error ? syncResult.error.message : syncResult.error.code}\" thrown in coleam00/Archon.","triggerScenarios":"Thrown at packages/adapters/src/forge/github/adapter.ts:711 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}