eyaltoledano/claude-task-master · error

${authCheck.error}

Error message

${authCheck.error}

What it means

createTagFromBranch runs isValidBranchForTag and throws when the branch name cannot be sanitized into a valid tag name (e.g. it would reduce to empty or contain only invalid characters). Tag names must satisfy the [a-zA-Z0-9_-] constraint, so some git branch names are unusable as-is.

Source

Thrown at apps/cli/src/commands/loop.command.ts:151

				verbose: options.verbose ?? false,
				brief: briefName,
				callbacks: this.createOutputCallbacks()
			};

			const result = await this.tmCore.loop.run(config);
			this.displayResult(result);
		} catch (error: unknown) {
			displayError(error, { skipExit: true });
			process.exit(1);
		}
	}

	private handleSandboxAuth(): void {
		console.log(chalk.dim('Checking sandbox auth...'));
		const authCheck = this.tmCore.loop.checkSandboxAuth();

		if (authCheck.error) {
			throw new Error(authCheck.error);
		}

		if (authCheck.ready) {
			console.log(chalk.green('✓ Sandbox ready'));
			return;
		}

		console.log(
			chalk.yellow(
				'Sandbox needs authentication. Starting interactive session...'
			)
		);
		console.log(chalk.dim('Please complete auth, then Ctrl+C to continue.\n'));

		const authResult = this.tmCore.loop.runInteractiveAuth();
		if (!authResult.success) {
			throw new Error(authResult.error || 'Interactive authentication failed');
		}

View on GitHub (pinned to c0c98d367c)

Solutions

  1. Pre-sanitize: strip 'refs/heads/' and replace '/' and '.' with '-' before calling
  2. Run sanitizeBranchNameForTag(branchName) yourself and pass a name that passes isValidBranchForTag
  3. Create the tag manually with createTag using a hand-picked valid name

Example fix

// before
await createTagFromBranch(tasksPath, 'refs/heads/feature/login');
// after
const name = 'refs/heads/feature/login'.replace('refs/heads/', '').replace(/[^a-zA-Z0-9_-]/g, '-');
await createTagFromBranch(tasksPath, name); // 'feature-login'
Defensive patterns

Strategy: validation

Validate before calling

const sanitized = branchName.replace(/^refs\/heads\//, '').replace(/[^a-zA-Z0-9_-]/g, '-').replace(/^-+|-+$/g, '');
if (!sanitized) throw new Error(`Branch "${branchName}" yields no valid tag name`);

Try / catch

try {
  await createTagFromBranch(tasksPath, branchName);
} catch (e) {
  if (e.message.includes('cannot be converted to a valid tag name')) {
    const safe = branchName.replace(/[^a-zA-Z0-9_-]/g, '-');
    return createTagFromBranch(tasksPath, safe);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling createTagFromBranch with branch names like 'refs/heads/feature/x' or names composed of characters that sanitize away entirely, leaving no valid tag name.

Common situations: Working on branches with slashes (GitFlow names) or dots/special characters; automating tag creation from CI where branch names include 'refs/heads/' prefixes.

Related errors


AI-assisted analysis of eyaltoledano/claude-task-master@c0c98d367c (2026-08-29). Data as JSON: /api/errors/2e44485f39c02fc9. Report an issue: GitHub.