{"record":{"id":"effc1e0d1e05f561","repo":"paperclipai/paperclip","slug":"invalid-scope-rawvalue-expected-a-comma-sepa","errorCode":null,"errorMessage":"Invalid scope \"${rawValue}\". Expected a comma-separated list of: ${WORKTREE_MERGE_SCOPES.join(\", \")}.","messagePattern":"Invalid scope \"(.+?)\"\\. Expected a comma-separated list of: (.+?)\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree-merge-history-lib.ts","lineNumber":332,"sourceCode":"    if (createdDelta !== 0) return createdDelta;\n    return left.id.localeCompare(right.id);\n  });\n}\n\nexport function parseWorktreeMergeScopes(rawValue: string | undefined): WorktreeMergeScope[] {\n  if (!rawValue || rawValue.trim().length === 0) {\n    return [\"issues\", \"comments\"];\n  }\n\n  const parsed = rawValue\n    .split(\",\")\n    .map((value) => value.trim().toLowerCase())\n    .filter((value): value is WorktreeMergeScope =>\n      (WORKTREE_MERGE_SCOPES as readonly string[]).includes(value),\n    );\n\n  if (parsed.length === 0) {\n    throw new Error(\n      `Invalid scope \"${rawValue}\". Expected a comma-separated list of: ${WORKTREE_MERGE_SCOPES.join(\", \")}.`,\n    );\n  }\n\n  return [...new Set(parsed)];\n}\n\nexport function buildWorktreeMergePlan(input: {\n  companyId: string;\n  companyName: string;\n  issuePrefix: string;\n  previewIssueCounterStart: number;\n  scopes: WorktreeMergeScope[];\n  sourceIssues: IssueRow[];\n  targetIssues: IssueRow[];\n  sourceComments: CommentRow[];\n  targetComments: CommentRow[];\n  sourceProjects?: ProjectRow[];","sourceCodeStart":314,"sourceCodeEnd":350,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/cli/src/commands/worktree-merge-history-lib.ts#L314-L350","documentation":"parseWorktreeMergeScopes splits the --scope value on commas and every token failed to match a known scope, so the merge scope list is empty after filtering; a generic scope-enum guard.","triggerScenarios":"Thrown at cli/src/commands/worktree-merge-history-lib.ts:332 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a comma-separated list from the allowed scopes shown in the error."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}