{"record":{"id":"49e00664f3996d6b","repo":"paperclipai/paperclip","slug":"invalid-branch-name-branchname-extractexec","errorCode":null,"errorMessage":"Invalid branch name \"${branchName}\": ${extractExecSyncErrorMessage(error) ?? String(error)}","messagePattern":"Invalid branch name \"(.+?)\": (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":685,"sourceCode":"    }).trim();\n    return nonEmpty(value);\n  } catch {\n    return null;\n  }\n}\n\nfunction validateGitBranchName(cwd: string, branchName: string): string {\n  const value = nonEmpty(branchName);\n  if (!value) {\n    throw new Error(\"Branch name is required.\");\n  }\n  try {\n    execFileSync(\"git\", [\"check-ref-format\", \"--branch\", value], {\n      cwd,\n      stdio: [\"ignore\", \"pipe\", \"pipe\"],\n    });\n  } catch (error) {\n    throw new Error(`Invalid branch name \"${branchName}\": ${extractExecSyncErrorMessage(error) ?? String(error)}`);\n  }\n  return value;\n}\n\nfunction isPrimaryGitWorktree(cwd: string): boolean {\n  const workspace = detectGitWorkspaceInfo(cwd);\n  return Boolean(workspace && workspace.gitDir === workspace.commonDir);\n}\n\nfunction resolvePrimaryGitRepoRoot(cwd: string): string {\n  const workspace = detectGitWorkspaceInfo(cwd);\n  if (!workspace) {\n    throw new Error(\"Current directory is not inside a git repository.\");\n  }\n  if (workspace.gitDir === workspace.commonDir) {\n    return workspace.root;\n  }\n  return path.resolve(workspace.commonDir, \"..\");","sourceCodeStart":667,"sourceCodeEnd":703,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/worktree.ts#L667-L703","documentation":"Delegated format check on git branch names: the value failed `git check-ref-format --branch`, meaning git itself considers it an invalid branch reference (bad characters, double dots, leading dash, etc.); the underlying git error is embedded in the message.","triggerScenarios":"Thrown at cli/src/commands/worktree.ts:636 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the branch name per git's naming rules (no spaces, no '..', no leading dash, etc.)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}