nodejs/node · error · Error
${tag} is not a dist-tag on ${spec.name}
Error message
${tag} is not a dist-tag on ${spec.name} What it means
`npm dist-tag rm <pkg> <tag>` fetches current tags and requires the named tag to exist; if tags[tag] is falsy it logs an info line and throws '<tag> is not a dist-tag on <pkg>'. This prevents no-op or misspelled deletions.
Source
Thrown at deps/npm/lib/commands/dist-tag.js:136
},
spec,
}
await otplease(this.npm, reqOpts, o => npmFetch(url, o))
output.standard(`+${t}: ${spec.name}@${version}`)
}
async remove (spec, tag, opts) {
spec = npa(spec || '')
log.verbose('dist-tag del', tag, 'from', spec.name)
if (!spec.name) {
throw this.usageError()
}
const tags = await this.fetchTags(spec, opts)
if (!tags[tag]) {
log.info('dist-tag del', tag, 'is not a dist-tag on', spec.name)
throw new Error(tag + ' is not a dist-tag on ' + spec.name)
}
const version = tags[tag]
delete tags[tag]
const url =
`/-/package/${spec.escapedName}/dist-tags/${encodeURIComponent(tag)}`
const reqOpts = {
...opts,
method: 'DELETE',
spec,
}
await otplease(this.npm, reqOpts, o => npmFetch(url, o))
output.standard(`-${tag}: ${spec.name}@${version}`)
}
async list (spec, opts) {
if (!spec) {
if (this.npm.global) {
throw this.usageError()View on GitHub (pinned to 1b2de5e052)
Solutions
- List existing tags first: `npm dist-tag ls <pkg>`
- Correct the tag name to match an existing one
- Make deletion idempotent in scripts by checking the list before calling rm
Defensive patterns
Strategy: validation
Validate before calling
async function tagExists(npm, spec, tag) {
const tags = await fetchTags(npm, spec) // same endpoint npm uses
return Object.prototype.hasOwnProperty.call(tags, tag)
} Type guard
function hasDistTag(tags, tag) {
return tags && Object.prototype.hasOwnProperty.call(tags, tag)
} Try / catch
try {
await npmDistTagRm(pkg, tag)
} catch (e) {
if (/is not a dist-tag/.test(e.message)) { /* already gone; treat as success */ }
else throw e
} Prevention
- List tags with `npm dist-tag ls` before removing
- Make rm idempotent in release scripts (check existence first)
- Watch for typos in tag names
When it happens
Trigger: Removing a tag that was already deleted, never created, or misspelled; operating on the wrong package name.
Common situations: Re-running a release script after a partial failure; concurrent publishes removing the same tag; typos like 'lates' instead of 'latest'.
Related errors
- No dist-tags found for ${spec.name}
- Tag name must not be a valid SemVer range: ${t}
- invalid version range: ${spec}
- Tag name must not be a valid SemVer range: ${defaultTag.trim
- Cannot use --no-workspaces and --workspace at the same time
AI-assisted analysis of nodejs/node@1b2de5e052 (2026-08-13).
Data as JSON: /api/errors/234d548801b91024.
Report an issue: GitHub.