{"record":{"id":"313c87b65490cd46","repo":"paperclipai/paperclip","slug":"branch-name-is-required","errorCode":null,"errorMessage":"Branch name is required.","messagePattern":"Branch name is required\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":677,"sourceCode":"}\n\nfunction detectGitBranchName(cwd: string): string | null {\n  try {\n    const value = execFileSync(\"git\", [\"branch\", \"--show-current\"], {\n      cwd,\n      encoding: \"utf8\",\n      stdio: [\"ignore\", \"pipe\", \"ignore\"],\n    }).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 {","sourceCodeStart":659,"sourceCodeEnd":695,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/cli/src/commands/worktree.ts#L659-L695","documentation":"Required-argument guard in git branch name validation: the candidate branch name (after trimming) is empty, so `git check-ref-format` would have nothing meaningful to validate and the worktree branch cannot be created.","triggerScenarios":"Thrown at cli/src/commands/worktree.ts:628 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a branch name (e.g. --branch <name>)."],"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"}