Hmbown/CodeWhale · error · Error
Refusing to replace existing assets for
Error message
Refusing to replace existing assets for ${tag}: ${inventory}. A normal Release workflow rerun must never delete or overwrite public bytes. What it means
Core safety refusal of assertReleaseAssetsAbsent(): the target release already has assets attached, so re-running asset upload would delete or overwrite published bytes. The inventory of existing asset names is embedded in the message. This enforces the project invariant that a normal Release workflow rerun is idempotent and never mutates public artifacts; a deliberate replacement requires an explicit, authorized procedure, not this script.
Solutions
- Verify you are targeting the right tag — assets may legitimately exist for an already-published release
- If re-publishing is truly required, delete the release (or its assets) through an explicit authorized process, then rerun
- Check whether a previous partial upload left stray assets that need manual cleanup
- Do not bypass this check in CI; it guards public artifact integrity
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at scripts/release/ensure-release-assets-absent.js:66 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Hmbown/CodeWhale@433685b202 (2026-09-15).
Data as JSON: /api/errors/4d4a494dbe6e5591.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/release/ensure-release-assets-absent.js:66
} catch (error) {
throw new Error(`GitHub Release ${tag} returned invalid JSON: ${error.message}`);
}
}
function assertReleaseAssetsAbsent(release, tag) {
if (release === null) {
return;
}
if (!release || !Array.isArray(release.assets)) {
throw new Error(`GitHub Release ${tag} did not provide an asset inventory`);
}
if (release.assets.length === 0) {
return;
}
const names = release.assets.map((asset) => asset && asset.name).filter(Boolean);
const inventory = names.length > 0 ? names.join(", ") : `${release.assets.length} unnamed asset(s)`;
throw new Error(
`Refusing to replace existing assets for ${tag}: ${inventory}. ` +
"A normal Release workflow rerun must never delete or overwrite public bytes.",
);
}
function main() {
if (process.argv.length !== 4) {
throw new Error(usage());
}
const repo = process.argv[2];
const tag = process.argv[3];
const release = fetchRelease(repo, tag);
assertReleaseAssetsAbsent(release, tag);
console.log(
release === null
? `No existing GitHub Release assets found for ${tag}.`
: `Existing GitHub Release ${tag} has no assets; first upload may proceed.`,
);View on GitHub (pinned to 433685b202)