{"record":{"id":"9fe67b851dcb357b","repo":"coleam00/Archon","slug":"failed-to-clone-owner-repo-unknownmsg","errorCode":null,"errorMessage":"Failed to clone ${owner}/${repo}: ${unknownMsg}","messagePattern":"Failed to clone (.+?)/(.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/adapters/src/community/forge/gitea/adapter.ts","lineNumber":558,"sourceCode":"    const cloneResult = await cloneRepository(repoUrl, toRepoPath(repoPath), {\n      token: process.env.GITEA_TOKEN,\n    });\n\n    if (!cloneResult.ok) {\n      getLog().error({ owner, repo, repoPath, error: cloneResult.error }, 'repo_clone_failed');\n\n      if (cloneResult.error.code === 'not_a_repo') {\n        throw new Error(\n          `Repository ${owner}/${repo} not found or is private. Check repository access.`\n        );\n      }\n      if (cloneResult.error.code === 'permission_denied') {\n        throw new Error(\n          `Authentication failed for ${owner}/${repo}. Check GITEA_TOKEN permissions.`\n        );\n      }\n      const unknownMsg = (cloneResult.error as { message?: string }).message ?? 'unknown error';\n      throw new Error(`Failed to clone ${owner}/${repo}: ${unknownMsg}`);\n    }\n\n    await addSafeDirectory(toRepoPath(repoPath));\n  }\n\n  /**\n   * Auto-detect and load commands from .archon/commands/ (or configured folder)\n   */\n  private async autoDetectAndLoadCommands(repoPath: string, codebaseId: string): Promise<void> {\n    const commandFolders = getCommandFolderSearchPaths();\n\n    for (const folder of commandFolders) {\n      try {\n        const fullPath = join(repoPath, folder);\n        await access(fullPath);\n\n        const files = (await readdir(fullPath)).filter(f => f.endsWith('.md'));\n        if (files.length === 0) continue;","sourceCodeStart":540,"sourceCodeEnd":576,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/adapters/src/community/forge/gitea/adapter.ts#L540-L576","documentation":"The catch-all clone failure path in ensureRepoReady: when the clone error code is neither 'not_a_repo' nor 'permission_denied', the adapter surfaces the underlying error's message (or 'unknown error') wrapped with the owner/repo. Typical underlying causes are network failures, invalid remote URL, or git binary problems.","triggerScenarios":"handleWebhook -> ensureRepoReady cloning while DNS/network to the Gitea host is down, the remote URL is malformed (bad scheme or path), the git credential/transport returns an unexpected error, or cloneResult.error carries no message at all (then 'unknown error' is shown).","commonSituations":"Self-hosted Gitea behind a firewall/proxy unreachable from the adapter host; TLS certificate verification failure; wrong instance URL in config; disk full mid-clone.","solutions":["Read the embedded unknownMsg for the root cause (DNS, TLS, network) and fix accordingly.","Test reachability: git ls-remote <gitea-url>/owner/repo.git from the adapter host.","Verify the configured Gitea base URL is correct (scheme, host, port).","If the message is 'unknown error', enable adapter debug logging to capture the raw clone failure, then retry."],"exampleFix":"// before\ngiteaUrl: \"http://gitea.internal:3000\" // host unreachable from adapter\n\n// after\ngiteaUrl: \"https://gitea.internal\" // reachable, valid TLS\n# verify: git ls-remote https://gitea.internal/owner/repo.git","handlingStrategy":"retry","validationCode":"// check remote reachability before handling webhooks\nconst { code } = Bun.spawnSync(['git', 'ls-remote', `${giteaUrl}/${owner}/${repo}.git`]);\nif (code !== 0) throw new Error('Gitea remote unreachable from adapter host');","typeGuard":null,"tryCatchPattern":"try {\n  await adapter.handleWebhook(update);\n} catch (err) {\n  const m = String(err);\n  if (m.startsWith('Failed to clone') && !m.includes('not found') && !m.includes('Authentication failed')) {\n    await sleep(2000); return adapter.handleWebhook(update); // transient network: one retry\n  }\n  throw err;\n}","preventionTips":["Verify the Gitea base URL (scheme/host/port/TLS) in config before deployment.","Run git ls-remote as a startup smoke test from the adapter host.","Watch for the 'unknown error' variant — enable debug logging to capture the raw git failure.","Ensure DNS and proxy settings are correct inside containers."],"tags":["gitea","clone","network"],"backgroundTag":"git-clone-failed","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}