tldraw/tldraw · error · Error

Invalid bump argument ${JSON.stringify(arg)}

Error message

Invalid bump argument ${JSON.stringify(arg)}

What it means

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.

Source

Thrown at internal/scripts/publish-new.ts:40

	  }
	| {
			bump: 'override'
			version: SemVer
	  }

function getReleaseType(): ReleaseType {
	const arg = minimist(process.argv.slice(2))['bump']
	if (!arg) {
		throw new Error('Must provide a --bump argument')
	}
	if (arg === 'major' || arg === 'minor') {
		return { bump: arg }
	}
	const parsed = parse(arg)
	if (parsed) {
		return { bump: 'override', version: parsed }
	}
	throw new Error('Invalid bump argument ' + JSON.stringify(arg))
}

async function getDraftRelease(version: string, octokit: Octokit) {
	const expectedVersion = `v${version}`

	// Fetch all releases with pagination
	const releases = await octokit.paginate(octokit.rest.repos.listReleases, {
		owner: 'tldraw',
		repo: 'tldraw',
		per_page: 100, // Maximum per page to reduce API calls
	})

	const draftRelease = releases.find((release) => release.draft && release.name === expectedVersion)

	if (!draftRelease) {
		const availableDrafts = releases
			.filter((r) => r.draft)
			.map((r) => r.name)

View on GitHub (pinned to b31086b447)

Solutions

  1. Use --bump=major or --bump=minor for an increment, or a bare semver string like --bump=3.12.1 for an override.
  2. For a patch release, use publish-patch.ts from the appropriate v{major}.{minor}.x branch instead of this script.
  3. Remove any 'v' prefix from the override value before passing it.

Example fix

// before
throw new Error('Invalid bump argument ' + JSON.stringify(arg))

// after: tell the operator what is accepted
throw new Error(
  `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.`
)
Defensive patterns

Strategy: validation

Validate before calling

import { parse } from 'semver'

function parseBump(arg: string): { bump: 'major' | 'minor' } | { bump: 'override'; version: string } {
  if (arg === 'major' || arg === 'minor') return { bump: arg }
  const parsed = parse(arg)
  if (parsed) return { bump: 'override', version: parsed.format() }
  throw new Error(
    `--bump must be 'major', 'minor', or a bare semver version (e.g. '3.12.1'). Got '${arg}'.`
  )
}

Type guard

import { parse } from 'semver'
function isValidBump(arg: unknown): boolean {
  return arg === 'major' || arg === 'minor' || !!parse(String(arg))
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of tldraw/tldraw@b31086b447 (2026-08-12). Data as JSON: /api/errors/bd1a561a9b524591. Report an issue: GitHub.