{"record":{"id":"f48f405fb9dbdf8a","repo":"coleam00/Archon","slug":"failed-to-sync-repository-to-defaultbranch-try-f48f40","errorCode":null,"errorMessage":"Failed to sync repository to ${defaultBranch}. Try /reset or check if the branch exists.","messagePattern":"Failed to sync repository to (.+?)\\. Try /reset or check if the branch exists\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapters/src/community/forge/gitlab/adapter.ts","lineNumber":455,"sourceCode":"      if (err.code !== 'ENOENT') {\n        getLog().error({ repoPath, errorCode: err.code, err }, 'gitlab.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    }\n\n    if (directoryExists) {\n      if (shouldSync) {\n        getLog().info({ repoPath, defaultBranch }, 'gitlab.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            'gitlab.repo_sync_failed'\n          );\n          throw new Error(\n            `Failed to sync repository to ${defaultBranch}. ` +\n              'Try /reset or check if the branch exists.'\n          );\n        }\n      }\n      return;\n    }\n\n    // Clone the repository\n    // GitLab self-hosted instances need oauth2:token auth and credential helper disabled\n    // to prevent macOS Keychain from intercepting and blocking the clone\n    getLog().info({ projectPath, repoPath }, 'gitlab.repo_cloning');\n\n    // Create project structure (source/, worktrees/, artifacts/, logs/) before\n    // cloning so worktree paths resolve correctly on first webhook clone.\n    // For nested namespaces (group/subgroup/repo), the namespace becomes the\n    // owner and the leaf segment becomes the repo.\n    const cloneSegments = projectPath.split('/');","sourceCodeStart":437,"sourceCodeEnd":473,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/adapters/src/community/forge/gitlab/adapter.ts#L437-L473","documentation":"Error \"Failed to sync repository to ${defaultBranch}. Try /reset or check if the branch exists.\" thrown in coleam00/Archon.","triggerScenarios":"Thrown at packages/adapters/src/community/forge/gitlab/adapter.ts:455 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"}