can1357/oh-my-pi · error · Error

Failed to refresh Bun's git cache for ${source.host}/${sourc

Error message

Failed to refresh Bun's git cache for ${source.host}/${source.path}: ${fetchResult.stderr}

What it means

refreshBunGitCache runs `git fetch` with forced refspecs for heads and tags into Bun's cached bare clone of the plugin repo. A non-zero git exit code aborts the refresh with the host/path and git's stderr embedded in the message.

Source

Thrown at packages/coding-agent/src/extensibility/plugins/bun-git-cache.ts:88

		const originResult = await runCommand(["git", "-C", repositoryDir, "config", "--get", "remote.origin.url"], cwd);
		if (originResult.exitCode !== 0 || normalizeRepositoryUrl(originResult.stdout.trim()) !== repositoryUrl) continue;

		const fetchResult = await runCommand(
			[
				"git",
				"-C",
				repositoryDir,
				"fetch",
				"--force",
				"--prune",
				"origin",
				"+refs/heads/*:refs/heads/*",
				"+refs/tags/*:refs/tags/*",
			],
			cwd,
		);
		if (fetchResult.exitCode !== 0) {
			throw new Error(`Failed to refresh Bun's git cache for ${source.host}/${source.path}: ${fetchResult.stderr}`);
		}
	}
}

View on GitHub (pinned to 9690622007)

Solutions

  1. Run `git ls-remote <repo-url>` manually to test connectivity/auth.
  2. For private repos, configure credentials (SSH key in ssh-agent, or HTTPS token via credential helper).
  3. Check proxy/VPN/firewall settings and corporate CA trust for git.
  4. If the cached clone's origin is stale, clear Bun's cache (`bun pm cache rm`) and reinstall the plugin.

Example fix

// before: failing SSH
"source": "git@unknownhost:team/plugin.git"
// after: reachable, authorized remote
"source": "git@github.com:team/plugin.git"
Defensive patterns

Strategy: retry

Validate before calling

const ls = Bun.spawnSync(["git", "ls-remote", `https://${source.host}/${source.path}`], { stdout: "pipe", stderr: "pipe" });
if (ls.exitCode !== 0) throw new Error(`Repo unreachable before update: ${ls.stderr.toString()}`);

Try / catch

try {
  await updateGitPlugin(source, cwd);
} catch (err) {
  if (err instanceof Error && err.message.startsWith("Failed to refresh Bun's git cache")) {
    await backoffRetry(() => updateGitPlugin(source, cwd), 3); // transient network blips
  } else throw err;
}

Prevention

When it happens

Trigger: Updating a git-sourced plugin when `git fetch` fails: network unreachable, auth required for a private repo, unknown host, or the cached clone's remote is broken.

Common situations: Offline/behind-proxy environments; private GitHub/GitLab repos without deploy keys or credentials; SSH keys not loaded (ssh-agent); deleted/renamed upstream repository; corporate TLS interception.

Related errors


AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31). Data as JSON: /api/errors/81c5fa43518b6773. Report an issue: GitHub.