{"record":{"id":"17a8490e833e542a","repo":"paperclipai/paperclip","slug":"worktree-name-is-required","errorCode":null,"errorMessage":"Worktree name is required.","messagePattern":"Worktree name is required\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":267,"sourceCode":"\nfunction formatSeededWorktreeExecutionQuarantineSummary(\n  summary: SeededWorktreeExecutionQuarantineSummary,\n): string {\n  return [\n    `disabled timer heartbeats: ${summary.disabledTimerHeartbeats}`,\n    `reset running agents: ${summary.resetRunningAgents}`,\n    `quarantined in-progress issues: ${summary.quarantinedInProgressIssues}`,\n    `unassigned todo issues: ${summary.unassignedTodoIssues}`,\n    `unassigned review issues: ${summary.unassignedReviewIssues}`,\n  ].join(\", \");\n}\n\nconst WORKTREE_NAME_PREFIX = \"paperclip-\";\n\nfunction resolveWorktreeMakeName(name: string): string {\n  const value = nonEmpty(name);\n  if (!value) {\n    throw new Error(\"Worktree name is required.\");\n  }\n  if (!/^[A-Za-z0-9._-]+$/.test(value)) {\n    throw new Error(\n      \"Worktree name must contain only letters, numbers, dots, underscores, or dashes.\",\n    );\n  }\n  return value.startsWith(WORKTREE_NAME_PREFIX) ? value : `${WORKTREE_NAME_PREFIX}${value}`;\n}\n\nfunction resolveWorktreeHome(explicit?: string): string {\n  return explicit ?? process.env.PAPERCLIP_WORKTREES_DIR ?? DEFAULT_WORKTREE_HOME;\n}\n\nfunction resolveWorktreeStartPoint(explicit?: string): string | undefined {\n  return explicit ?? nonEmpty(process.env.PAPERCLIP_WORKTREE_START_POINT) ?? undefined;\n}\n\ntype ConfiguredStorage = {","sourceCodeStart":249,"sourceCodeEnd":285,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/worktree.ts#L249-L285","documentation":"Thrown by resolveWorktreeMakeName when the provided worktree name is empty or only whitespace after trimming (nonEmpty returns null). A worktree requires a name because it becomes the branch/directory identifier (prefixed with 'paperclip-'). This is the required-field guard that runs before the character-set validation.","triggerScenarios":"Invoking the worktree make/create flow with an empty --name flag, an all-whitespace name, or programmatically calling resolveWorktreeMakeName('') / resolveWorktreeMakeName('   '). nonEmpty trims and returns null when length is 0.","commonSituations":"Shell quoting bug dropping the argument (`paperclipai worktree make \"\"`). Scripted call with an unset variable. UI/CLI form submitted without entering a name.","solutions":["Provide a non-empty name: `paperclipai worktree make my-feature`.","If the name comes from a variable, default it: `--name \"${NAME:-default}\"`.","Validate the name is non-empty in your wrapper script before invoking the CLI."],"exampleFix":"# before\npaperclipai worktree make \"\"\n# after\npaperclipai worktree make my-feature","handlingStrategy":"validation","validationCode":"function requireWorktreeName(name: string): string {\n  const trimmed = name.trim();\n  if (!trimmed) throw new Error('Worktree name is required.');\n  return trimmed;\n}\n// const name = requireWorktreeName(input);  // gates before resolveWorktreeMakeName","typeGuard":"function isNonEmptyName(name: unknown): name is string {\n  return typeof name === 'string' && name.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Make the worktree name a required CLI argument with a non-empty validator in your arg parser.","Default unset names to a generated slug (e.g. issue-id) rather than passing ''.","Trim user input before validation."],"tags":["validation","worktree","required-field"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}