{"record":{"id":"af216be64f1d233e","repo":"can1357/oh-my-pi","slug":"cloned-repository-url-err-as-error-message","errorCode":null,"errorMessage":"Cloned repository ${url}: ${(err as Error).message} (source: ${source})","messagePattern":"Cloned repository (.+?): (.+?) \\(source: (.+?)\\)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/extensibility/plugins/marketplace/fetcher.ts","lineNumber":302,"sourceCode":" *\n * Clones to a temporary directory and reads the catalog. The caller is\n * responsible for promoting the clone to its final cache location via\n * `promoteCloneToCache` after any duplicate/drift checks pass.\n */\nasync function cloneAndReadCatalog(url: string, source: string, cacheDir: string): Promise<FetchResult> {\n\tconst tmpDir = path.join(cacheDir, `.tmp-clone-${Date.now()}`);\n\tawait fs.mkdir(cacheDir, { recursive: true });\n\n\tlogger.debug(`[marketplace] cloning ${url} → ${tmpDir}`);\n\tawait vcs.clone(url, tmpDir, { timeoutMs: GIT_CLONE_TIMEOUT_MS });\n\n\ttry {\n\t\tconst { displayPath, content } = await readMarketplaceCatalog(tmpDir, { relativeDisplayPaths: true });\n\t\tconst catalog = parseMarketplaceCatalog(content, displayPath);\n\t\treturn { catalog, clonePath: tmpDir };\n\t} catch (err) {\n\t\tawait fs.rm(tmpDir, { recursive: true, force: true }).catch(() => {});\n\t\tthrow new Error(`Cloned repository ${url}: ${(err as Error).message} (source: ${source})`, { cause: err });\n\t}\n}\n\n/**\n * Promote a temporary clone directory to its final cache location.\n *\n * Callers should invoke this only after duplicate/drift checks pass.\n * Removes any existing directory at the target path before renaming.\n */\nexport async function promoteCloneToCache(tmpDir: string, cacheDir: string, name: string): Promise<string> {\n\tconst finalDir = path.join(cacheDir, name);\n\tawait fs.rm(finalDir, { recursive: true, force: true });\n\tawait fs.rename(tmpDir, finalDir);\n\treturn finalDir;\n}\n","sourceCodeStart":284,"sourceCodeEnd":318,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/extensibility/plugins/marketplace/fetcher.ts#L284-L318","documentation":"cloneAndReadCatalog clones a git-hosted marketplace, reads and validates the catalog, and throws this wrapper error if any step fails, cleaning up the temp clone first. The original failure (clone error, missing catalog file, parse error) is preserved as the message suffix and error cause.","triggerScenarios":"fetchMarketplace called with a git source where `git clone` fails (bad URL, no network, auth required), or the clone succeeds but readMarketplaceCatalog/parseMarketplaceCatalog fail (no catalog file, invalid JSON, wrong shape).","commonSituations":"Private repository without SSH keys or credentials configured; nonexistent repo or typo in the git URL; offline machine; firewall blocking git over HTTPS; upstream repo restructured and removed the catalog.","solutions":["Read the trailing message and cause: if it's a clone error, verify the URL exists and you have access (`git clone <url>` manually).","For private repos, configure git credentials (SSH key, credential helper, or token) so the clone can authenticate.","Check network/proxy connectivity, then retry; if the repo lacks a catalog file, point at the right path or re-add with a corrected source."],"exampleFix":"// before: unreachable private repo\nawait manager.addMarketplace(\"github:myorg/private-market\");\n// after: credentials configured, then retry\n// git config credential.helper store / ssh key added\nawait manager.addMarketplace(\"github:myorg/private-market\");","handlingStrategy":"try-catch","validationCode":"const probe = Bun.spawnSync([\"git\", \"ls-remote\", gitUrl], { stdout: \"pipe\", stderr: \"pipe\" });\nif (probe.exitCode !== 0) throw new Error(`Cannot access repository ${gitUrl}: ${probe.stderr.toString()}`);","typeGuard":null,"tryCatchPattern":"try {\n  const { catalog, clonePath } = await fetchMarketplace(gitSource, cacheDir);\n} catch (err) {\n  const msg = (err as Error).message;\n  if (msg.startsWith(\"Cloned repository\")) {\n    // inspect cause: clone auth failure vs missing/invalid catalog\n    console.error(msg); // includes original error text and source\n  } else throw err;\n}","preventionTips":["Verify `git clone <url>` works manually before registering the source.","Configure SSH keys or credential helpers for private marketplace repos.","Confirm the repo contains a catalog file at a supported path.","Check network/proxy settings if clones fail intermittently in CI."],"tags":["git","clone","network","marketplace"],"backgroundTag":"git-clone-failed","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}