{"record":{"id":"bd1a561a9b524591","repo":"tldraw/tldraw","slug":"invalid-bump-argument-json-stringify-arg","errorCode":null,"errorMessage":"Invalid bump argument ${JSON.stringify(arg)}","messagePattern":"Invalid bump argument (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"internal/scripts/publish-new.ts","lineNumber":40,"sourceCode":"\t  }\n\t| {\n\t\t\tbump: 'override'\n\t\t\tversion: SemVer\n\t  }\n\nfunction getReleaseType(): ReleaseType {\n\tconst arg = minimist(process.argv.slice(2))['bump']\n\tif (!arg) {\n\t\tthrow new Error('Must provide a --bump argument')\n\t}\n\tif (arg === 'major' || arg === 'minor') {\n\t\treturn { bump: arg }\n\t}\n\tconst parsed = parse(arg)\n\tif (parsed) {\n\t\treturn { bump: 'override', version: parsed }\n\t}\n\tthrow new Error('Invalid bump argument ' + JSON.stringify(arg))\n}\n\nasync function getDraftRelease(version: string, octokit: Octokit) {\n\tconst expectedVersion = `v${version}`\n\n\t// Fetch all releases with pagination\n\tconst releases = await octokit.paginate(octokit.rest.repos.listReleases, {\n\t\towner: 'tldraw',\n\t\trepo: 'tldraw',\n\t\tper_page: 100, // Maximum per page to reduce API calls\n\t})\n\n\tconst draftRelease = releases.find((release) => release.draft && release.name === expectedVersion)\n\n\tif (!draftRelease) {\n\t\tconst availableDrafts = releases\n\t\t\t.filter((r) => r.draft)\n\t\t\t.map((r) => r.name)","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/tldraw/tldraw/blob/b31086b44731a7d1d9d46be4163ac8ef7417321d/internal/scripts/publish-new.ts#L22-L58","documentation":"Thrown by the new-release publisher when --bump is present but is neither the literal 'major'/'minor' nor a string semver can parse. The script only supports two bump modes (a named increment or an explicit override version), so anything else is rejected.","triggerScenarios":"Passing --bump=patch (not supported by this script; patch releases go through publish-patch.ts), --bump=latest, --bump=prerelease, or a malformed version like --bump=3.1 or --bump=v3.12.1 (the 'v' prefix fails semver.parse).","commonSituations":"Operator confused this script with publish-patch.ts and passed --bump=patch. Operator included a 'v' prefix in the override version. A CI input dropdown offered 'patch' as an option but this script rejects it.","solutions":["Use --bump=major or --bump=minor for an increment, or a bare semver string like --bump=3.12.1 for an override.","For a patch release, use publish-patch.ts from the appropriate v{major}.{minor}.x branch instead of this script.","Remove any 'v' prefix from the override value before passing it."],"exampleFix":"// before\nthrow new Error('Invalid bump argument ' + JSON.stringify(arg))\n\n// after: tell the operator what is accepted\nthrow new Error(\n  `Invalid --bump argument ${JSON.stringify(arg)}. Use 'major', 'minor', or a bare semver version (e.g. '3.12.1'). For patches, use publish-patch.ts.`\n)","handlingStrategy":"validation","validationCode":"import { parse } from 'semver'\n\nfunction parseBump(arg: string): { bump: 'major' | 'minor' } | { bump: 'override'; version: string } {\n  if (arg === 'major' || arg === 'minor') return { bump: arg }\n  const parsed = parse(arg)\n  if (parsed) return { bump: 'override', version: parsed.format() }\n  throw new Error(\n    `--bump must be 'major', 'minor', or a bare semver version (e.g. '3.12.1'). Got '${arg}'.`\n  )\n}","typeGuard":"import { parse } from 'semver'\nfunction isValidBump(arg: unknown): boolean {\n  return arg === 'major' || arg === 'minor' || !!parse(String(arg))\n}","tryCatchPattern":null,"preventionTips":["Use a CI input dropdown restricted to 'major' and 'minor' to eliminate typos.","For overrides, copy the version from `npm show tldraw version` to avoid manual transcription.","Remember patch releases use publish-patch.ts, not this script."],"tags":["release","cli","semver","config"],"backgroundTag":null,"analyzedSha":"b31086b44731a7d1d9d46be4163ac8ef7417321d","analyzedAt":"2026-08-12T17:05:39.947Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}