{"record":{"id":"47516803b232f8f0","repo":"coleam00/Archon","slug":"workflow-workflow-name-sets-worktree-enabled-475168","errorCode":null,"errorMessage":"Workflow '${workflow.name}' sets worktree.enabled: true (requires a worktree).\n  --no-worktree conflicts with the workflow policy.\n  Drop --no-worktree or change the workflow's worktree.enabled.","messagePattern":"Workflow '(.+?)' sets worktree\\.enabled: true \\(requires a worktree\\)\\.\n  --no-worktree conflicts with the workflow policy\\.\n  Drop --no-worktree or change the workflow's worktree\\.enabled\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cli/src/commands/workflow.ts","lineNumber":1914,"sourceCode":"    }\n    if (options.fromBranch !== undefined) {\n      throw new Error(\n        `Workflow '${workflow.name}' sets worktree.enabled: false (runs in live checkout).\\n` +\n          '  --from/--from-branch only applies when a worktree is created.\\n' +\n          \"  Drop --from or change the workflow's worktree.enabled.\"\n      );\n    }\n    if (options.baseBranch !== undefined) {\n      throw new Error(\n        `Workflow '${workflow.name}' sets worktree.enabled: false (runs in live checkout).\\n` +\n          '  --base only applies when a worktree is created.\\n' +\n          \"  Drop --base or change the workflow's worktree.enabled.\"\n      );\n    }\n    // --no-worktree is redundant but not contradictory — silently accept.\n  } else if (pinnedEnabled === true) {\n    if (options.noWorktree) {\n      throw new Error(\n        `Workflow '${workflow.name}' sets worktree.enabled: true (requires a worktree).\\n` +\n          '  --no-worktree conflicts with the workflow policy.\\n' +\n          \"  Drop --no-worktree or change the workflow's worktree.enabled.\"\n      );\n    }\n  }\n\n  // Default to worktree isolation unless --no-worktree or --resume. Workflow YAML\n  // `worktree.enabled` pins the decision — mismatches with CLI flags are rejected\n  // above, so by this point policy (if set) and flags agree. `--resume` reuses an\n  // existing worktree and takes precedence over the pinned policy. Computed here\n  // (not at the worktree block below) because --detach also needs it to decide\n  // whether to pin a generated branch on the child.\n  const flagWantsIsolation = !options.resume && !options.noWorktree;\n  // Reassigned by adoption resolution (#2747): adopting a branch whose worktree\n  // is gone forces isolation ON to cut a fresh worktree FROM that branch.\n  let wantsIsolation =\n    !options.resume && pinnedEnabled !== undefined ? pinnedEnabled : flagWantsIsolation;","sourceCodeStart":1896,"sourceCodeEnd":1932,"githubUrl":"https://github.com/coleam00/Archon/blob/0773b9745896ef0612e709c80845a0f7db315b19/packages/cli/src/commands/workflow.ts#L1896-L1932","documentation":"A workflow whose YAML pins `worktree.enabled: true` requires an isolated worktree for every run. Passing `--no-worktree` directly contradicts that policy, so the preflight rejects the invocation rather than letting the flag override the workflow's declared isolation requirement.","triggerScenarios":"`archon workflow start <workflow-with-worktree-enabled-true> --no-worktree` — options.noWorktree set while workflow.worktree.enabled === true.","commonSituations":"Trying to force a worktree-requiring workflow (e.g. one operating on PR branches) to run in the live checkout for speed; sharing one launch command across workflows with different policies.","solutions":["Drop `--no-worktree` and let the run use its isolated worktree.","Change the workflow YAML to `worktree.enabled: false` only if the workflow is genuinely safe to run in the live checkout."],"exampleFix":"// before\narchon workflow start pr-review --no-worktree\n// after\narchon workflow start pr-review","handlingStrategy":"validation","validationCode":"if (wf.worktree?.enabled === true && args.includes('--no-worktree')) {\n  throw new Error(`${wf.name} requires a worktree; --no-worktree conflicts with its policy.`);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Don't force --no-worktree on workflows that declare isolation as a requirement.","If live-checkout execution is needed, change the workflow YAML deliberately, not the invocation."],"tags":["cli","flag-conflict","worktree","workflow-config"],"backgroundTag":"flag-vs-workflow-policy-conflict","analyzedSha":"0773b9745896ef0612e709c80845a0f7db315b19","analyzedAt":"2026-09-01T02:28:07.064Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}