can1357/oh-my-pi · error · Error
GitHub release tag mismatch: expected ${expectedTag}
Error message
GitHub release tag mismatch: expected ${expectedTag} What it means
resolveReleaseBinaryAsset pins the download to an exact release tag. After basic shape validation it compares the payload's tag_name with the expected tag; any mismatch throws this error naming the expected tag. This prevents installing binaries from a different release than the one the update flow resolved.
Source
Thrown at packages/coding-agent/src/cli/update-cli.ts:200
/**
* Select and validate the binary asset from GitHub release metadata.
*
* Draft releases are always rejected. Prereleases are rejected unless
* `options.allowPrerelease` is set, which the canary channel passes: canary
* GitHub releases are published as prereleases, and the exact-tag match below
* still pins the download to the specific requested version.
*/
export function resolveReleaseBinaryAsset(
release: unknown,
expectedTag: string,
binaryName: string,
options: { allowPrerelease?: boolean } = {},
): ReleaseBinaryAsset {
if (!isRecord(release)) {
throw new Error("Invalid GitHub release metadata");
}
if (release.tag_name !== expectedTag) {
throw new Error(`GitHub release tag mismatch: expected ${expectedTag}`);
}
if (release.draft !== false) {
throw new Error(`GitHub release ${expectedTag} is a draft, not a published release`);
}
if (release.prerelease !== false && !options.allowPrerelease) {
throw new Error(`GitHub release ${expectedTag} is a prerelease; only canary updates install prerelease assets`);
}
if (!Array.isArray(release.assets)) {
throw new Error(`GitHub release ${expectedTag} has no asset list`);
}
const matches = release.assets.filter(asset => isRecord(asset) && asset.name === binaryName);
if (matches.length !== 1) {
throw new Error(`GitHub release ${expectedTag} has ${matches.length} assets named ${binaryName}`);
}
const asset = matches[0];
if (!isRecord(asset) || asset.state !== "uploaded") {View on GitHub (pinned to 9690622007)
Solutions
- Re-run the update command to re-fetch fresh release metadata.
- Clear/inspect any proxy or CDN cache in front of api.github.com if you route through one.
- Confirm the intended channel (stable/canary) — canary expects a specific prerelease tag.
- As a fallback, download the correct release binary manually from the GitHub releases page and install it directly.
Example fix
null
Defensive patterns
Strategy: type-guard
Validate before calling
if (release?.tag_name !== expectedTag) {
console.warn(`Mirror/cache drift: got ${release?.tag_name}, want ${expectedTag}`);
} Type guard
function hasExpectedTag(v: unknown, expectedTag: string): v is { tag_name: string; draft: boolean; prerelease: boolean; assets: unknown[] } {
return typeof v === "object" && v !== null && (v as any).tag_name === expectedTag;
} Try / catch
try {
const asset = resolveReleaseBinaryAsset(release, expectedTag, binaryName);
} catch (err) {
if (err instanceof Error && err.message.startsWith("GitHub release tag mismatch")) {
console.error("Stale mirror/cache or re-tagged release; refetch metadata and retry.");
}
throw err;
} Prevention
- Fetch release metadata fresh immediately before validating (no long-lived cache).
- Avoid third-party mirrors that may serve different releases.
- Re-run the update after a maintainer re-tags a release.
- Pin the channel explicitly so stable and canary never cross tags.
When it happens
Trigger: The release metadata's tag_name differs from expectedTag — e.g. a redirect/mirror serving a different (older/newer) release, a race where the release was re-tagged or replaced between lookup and validation, or passing the wrong expectedTag to the resolver.
Common situations: Updating through a GitHub mirror/proxy that caches a different release; release re-tagging by maintainers; concurrent update channels (stable vs canary) pointing at different tags; stale CDN cache.
Related errors
- Invalid GitHub release metadata
- GitHub release ${expectedTag} is a draft, not a published re
- GitHub release ${expectedTag} is a prerelease; only canary u
- invalid glob `{pattern}`: {error}
- GitHub release ${expectedTag} has no asset list
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/011a3322ffec8b55.
Report an issue: GitHub.