{"record":{"id":"4d4a494dbe6e5591","repo":"Hmbown/CodeWhale","slug":"refusing-to-replace-existing-assets-for-tag-inventory-a","errorCode":null,"errorMessage":"Refusing to replace existing assets for ${tag}: ${inventory}. A normal Release workflow rerun must never delete or overwrite public bytes.","messagePattern":"Refusing to replace existing assets for (.+?): (.+?)\\. A normal Release workflow rerun must never delete or overwrite public bytes\\.","errorType":"console","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/release/ensure-release-assets-absent.js","lineNumber":66,"sourceCode":"  } catch (error) {\n    throw new Error(`GitHub Release ${tag} returned invalid JSON: ${error.message}`);\n  }\n}\n\nfunction assertReleaseAssetsAbsent(release, tag) {\n  if (release === null) {\n    return;\n  }\n  if (!release || !Array.isArray(release.assets)) {\n    throw new Error(`GitHub Release ${tag} did not provide an asset inventory`);\n  }\n  if (release.assets.length === 0) {\n    return;\n  }\n\n  const names = release.assets.map((asset) => asset && asset.name).filter(Boolean);\n  const inventory = names.length > 0 ? names.join(\", \") : `${release.assets.length} unnamed asset(s)`;\n  throw new Error(\n    `Refusing to replace existing assets for ${tag}: ${inventory}. ` +\n      \"A normal Release workflow rerun must never delete or overwrite public bytes.\",\n  );\n}\n\nfunction main() {\n  if (process.argv.length !== 4) {\n    throw new Error(usage());\n  }\n  const repo = process.argv[2];\n  const tag = process.argv[3];\n  const release = fetchRelease(repo, tag);\n  assertReleaseAssetsAbsent(release, tag);\n  console.log(\n    release === null\n      ? `No existing GitHub Release assets found for ${tag}.`\n      : `Existing GitHub Release ${tag} has no assets; first upload may proceed.`,\n  );","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/scripts/release/ensure-release-assets-absent.js#L48-L84","documentation":"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.","triggerScenarios":"Thrown at scripts/release/ensure-release-assets-absent.js:66 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}