{"record":{"id":"05285e42fe8686d2","repo":"sinelaw/fresh","slug":"pkg-failed-to-update-registry-source-result-stderr","errorCode":null,"errorMessage":"[pkg] Failed to update registry ${source}: ${result.stderr}","messagePattern":"\\[pkg\\] Failed to update registry (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"crates/fresh-editor/plugins/pkg.ts","lineNumber":506,"sourceCode":"  const errors: string[] = [];\n\n  for (const source of sources) {\n    const indexPath = editor.pathJoin(INDEX_DIR, hashString(source));\n\n    if (fsLocal.fileExists(indexPath)) {\n      // Update existing\n      editor.setStatus(`Updating registry: ${source}...`);\n      const result = await gitCommand([\"-C\", `${indexPath}`, \"pull\", \"--ff-only\"]);\n      if (result.exit_code === 0) {\n        synced++;\n      } else {\n        const errorMsg = result.stderr.includes(\"Could not resolve host\")\n          ? \"Network error\"\n          : result.stderr.includes(\"Authentication\") || result.stderr.includes(\"403\")\n          ? \"Authentication failed (check if repo is public)\"\n          : result.stderr.split(\"\\n\")[0] || \"Unknown error\";\n        errors.push(`${source}: ${errorMsg}`);\n        editor.warn(`[pkg] Failed to update registry ${source}: ${result.stderr}`);\n      }\n    } else {\n      // Clone new\n      editor.setStatus(`Cloning registry: ${source}...`);\n      const result = await gitCommand([\"clone\", \"--depth\", \"1\", `${source}`, `${indexPath}`]);\n      if (result.exit_code === 0) {\n        synced++;\n      } else {\n        const errorMsg = result.stderr.includes(\"Could not resolve host\")\n          ? \"Network error\"\n          : result.stderr.includes(\"not found\") || result.stderr.includes(\"404\")\n          ? \"Repository not found\"\n          : result.stderr.includes(\"Authentication\") || result.stderr.includes(\"403\")\n          ? \"Authentication failed (check if repo is public)\"\n          : result.stderr.split(\"\\n\")[0] || \"Unknown error\";\n        errors.push(`${source}: ${errorMsg}`);\n        editor.warn(`[pkg] Failed to clone registry ${source}: ${result.stderr}`);\n      }","sourceCodeStart":488,"sourceCodeEnd":524,"githubUrl":"https://github.com/sinelaw/fresh/blob/67894ca5463dbd7a89bb31add4627c27d6b79d83/crates/fresh-editor/plugins/pkg.ts#L488-L524","documentation":"A non-fatal `editor.warn` from `syncRegistry` in crates/fresh-editor/plugins/pkg.ts:506. When an existing registry clone fails to update via git, the plugin logs `[pkg] Failed to update registry ${source}: ${result.stderr}` with the raw git stderr. It indicates the git fetch/pull for one registry source failed (network, auth, or repo problems) — sync continues with other sources.","triggerScenarios":"`syncRegistry` runs for an already-cloned registry directory and `gitCommand` (e.g. `git pull`/`fetch`) exits non-zero: no DNS (\"Could not resolve host\"), private repo / 403, missing remote, or any other git failure with stderr output.","commonSituations":"Working offline or behind a proxy/firewall; registry repo made private or deleted; expired git credentials or missing deploy key; wrong registry URL configured in pkg settings.","solutions":["Check network/DNS and proxy settings, then re-run the package sync","Verify the registry URL is a public, reachable git repo (`git ls-remote <url>`)","Fix git credentials (SSH key, token) for the host","Delete the stale registry clone at the index path so the next sync does a fresh clone"],"exampleFix":"// before (config)\nregistries: [\"git@private-host:team/registry.git\"]\n// after\nregistries: [\"https://github.com/team/registry.git\"]","handlingStrategy":"retry","validationCode":"// before syncing, check reachability\nconst ok = await editor.canReach ? await editor.canReach(source) : true;\nif (!ok) { editor.setStatus('Offline: skipping registry sync'); return; }\n// verify repo exists\n// git ls-remote <source> exit code 0","typeGuard":"function isGitFailure(result) { return typeof result === 'object' && typeof result.exit_code === 'number' && typeof result.stderr === 'string'; }","tryCatchPattern":"const result = await gitCommand(['pull'], indexPath);\nif (result.exit_code !== 0) {\n  if (result.stderr.includes('Could not resolve host') && retries < 3) { await sleep(2000); return syncRegistry(); }\n  editor.warn(`[pkg] Failed to update registry ${source}: ${result.stderr}`);\n}","preventionTips":["Check network/proxy availability before syncing registries","Use HTTPS URLs with tokens instead of SSH for portability","Periodically prune and re-clone stale registry directories","Configure multiple fallback registries so one failure doesn't block installs"],"tags":["git","network","plugin","registry-sync"],"backgroundTag":"git-command-failed","analyzedSha":"67894ca5463dbd7a89bb31add4627c27d6b79d83","analyzedAt":"2026-09-13T15:04:03.701Z","contentChangedAt":"2026-09-13T15:04:03.701Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}