{"record":{"id":"2d241be054c636d2","repo":"Hmbown/CodeWhale","slug":"worktree-repo-and-branch-must-be-provided-toge","errorCode":null,"errorMessage":"--worktree-repo and --branch must be provided together","messagePattern":"--worktree-repo and --branch must be provided together","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/src/lib.rs","lineNumber":832,"sourceCode":"        environment,\n        cwd,\n    } = request;\n    let kind = RuntimeBackendKind::parse(&runtime)?;\n    let reg = LaneRegistry::open_default()?;\n    let mut record = reg.create_pending(workflow, fleet, issue, goal, kind, worktree_ttl_secs)?;\n    let worktree = match (worktree_repo, branch) {\n        (Some(repo_root), Some(branch_name)) => {\n            let path = worktree_path\n                .unwrap_or_else(|| repo_root.join(\".codewhale\").join(\"lanes\").join(&record.id));\n            Some(WorktreeProvision {\n                repo_root,\n                branch: branch_name,\n                path,\n                base_ref: None,\n            })\n        }\n        (None, None) => None,\n        _ => bail!(\"--worktree-repo and --branch must be provided together\"),\n    };\n    let cmd = if command.is_empty() {\n        vec![\n            \"sh\".into(),\n            \"-c\".into(),\n            format!(\"echo lane {} started\", record.id),\n        ]\n    } else {\n        command\n    };\n    let spec = LaneStartSpec {\n        command: cmd,\n        cwd,\n        environment,\n        log_proxy: (kind == RuntimeBackendKind::Tmux)\n            .then(std::env::current_exe)\n            .transpose()\n            .context(\"resolve current Codewhale executable for tmux log proxy\")?,","sourceCodeStart":814,"sourceCodeEnd":850,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/cli/src/lib.rs#L814-L850","documentation":"When parsing worktree lane options in crates/cli/src/lib.rs, `--worktree-repo` and `--branch` form a pair: providing exactly neither is fine, but providing only one is ambiguous, so the match arm `_ => bail!(...)` rejects it. The library cannot infer whether the lone flag should pair with a default repo/branch, so it fails loudly.","triggerScenarios":"Running a lane command with `--worktree-repo <repo>` but no `--branch`, or `--branch <name>` but no `--worktree-repo`; the (Some/None or None/Some) pattern match falls into `_`.","commonSituations":"Users thinking `--branch` alone implies the current repo; scripts where one of the two flags is set conditionally and the other is missing due to an unset environment variable.","solutions":["Pass both flags together: `--worktree-repo <repo> --branch <branch>`.","Pass neither flag if you don't want a worktree lane.","Fix the script so both variables are set or both flags are omitted (e.g. pair them behind one condition)."],"exampleFix":"// before\ncodewhale lane --worktree-repo ~/src/proj\n// after\ncodewhale lane --worktree-repo ~/src/proj --branch feature/x","handlingStrategy":"validation","validationCode":"if (!!repo !== !!branch) throw new Error('--worktree-repo and --branch must be provided together');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set worktree-repo and branch as a pair in scripts.","Gate both flags behind a single condition/variable."],"tags":["cli","lane","argument-parsing","worktree"],"backgroundTag":"missing-required-flag","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}