{"record":{"id":"481bf596c685200f","repo":"paperclipai/paperclip","slug":"use-either-the-positional-source-argument-or-fro","errorCode":null,"errorMessage":"Use either the positional source argument or --from, not both.","messagePattern":"Use either the positional source argument or --from, not both\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/worktree.ts","lineNumber":3296,"sourceCode":"      insertedIssues,\n      insertedComments,\n      insertedDocuments,\n      mergedDocuments,\n      insertedDocumentRevisions,\n      insertedAttachments,\n      skippedMissingAttachmentObjects,\n      insertedIssueIdentifiers,\n    };\n  });\n}\n\nexport async function worktreeMergeHistoryCommand(sourceArg: string | undefined, opts: WorktreeMergeHistoryOptions): Promise<void> {\n  if (opts.apply && opts.dry) {\n    throw new Error(\"Use either --apply or --dry, not both.\");\n  }\n\n  if (sourceArg && opts.from) {\n    throw new Error(\"Use either the positional source argument or --from, not both.\");\n  }\n\n  const targetEndpoint = opts.to\n    ? resolveWorktreeEndpointFromSelector(opts.to, { allowCurrent: true })\n    : resolveCurrentWorktreeEndpoint();\n  const sourceEndpoint = opts.from\n    ? resolveWorktreeEndpointFromSelector(opts.from, { allowCurrent: true })\n    : sourceArg\n      ? resolveWorktreeEndpointFromSelector(sourceArg, { allowCurrent: true })\n      : await promptForSourceEndpoint(targetEndpoint.rootPath);\n\n  if (path.resolve(sourceEndpoint.configPath) === path.resolve(targetEndpoint.configPath)) {\n    throw new Error(\"Source and target Paperclip configs are the same. Choose different --from/--to worktrees.\");\n  }\n\n  const scopes = parseWorktreeMergeScopes(opts.scope);\n  const sourceHandle = await openConfiguredDb(sourceEndpoint.configPath);\n  const targetHandle = await openConfiguredDb(targetEndpoint.configPath);","sourceCodeStart":3278,"sourceCodeEnd":3314,"githubUrl":"https://github.com/paperclipai/paperclip/blob/67001ec6eb96ae601aa27bc91d9b2415d665334a/cli/src/commands/worktree.ts#L3278-L3314","documentation":"Thrown at the top of worktreeMergeHistoryCommand when both a positional [source] argument and the --from option are supplied. The positional exists as a back-compat alias for --from; providing both is ambiguous so the CLI rejects it. The guard fires before any selector resolution.","triggerScenarios":"Calling `paperclipai worktree:merge-history <path> --from <other>` with both the positional source and --from set.","commonSituations":"A developer migrates from the old positional-only syntax to --from but leaves the positional in place. Or a shell alias/script concatenates args and ends up populating both.","solutions":["Remove the positional argument and use only --from.","Or remove --from and rely on the positional source argument."],"exampleFix":"// before\npaperclipai worktree:merge-history feature-x --from feature-y\n// after\npaperclipai worktree:merge-history --from feature-y","handlingStrategy":"validation","validationCode":"function resolveSourceInput(positional: string | undefined, fromFlag: string | undefined): string | undefined {\n  if (positional && fromFlag) {\n    throw new Error(\"Use either the positional source argument or --from, not both.\");\n  }\n  return positional ?? fromFlag;\n}\n\nconst source = resolveSourceInput(argv[2], opts.from);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Standardize on --from in scripts and aliases; stop using the positional form to avoid confusion.","When shelling out, build argv from a single source variable so both forms cannot be populated simultaneously."],"tags":["worktree","cli","merge","argument-validation"],"backgroundTag":null,"analyzedSha":"67001ec6eb96ae601aa27bc91d9b2415d665334a","analyzedAt":"2026-08-12T12:05:45.408Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}