{"record":{"id":"4171080c0130541a","repo":"Yeachan-Heo/oh-my-codex","slug":"setup-agents-merge-policy-flags-do-not-accept-valu","errorCode":null,"errorMessage":"Setup AGENTS merge policy flags do not accept values: ${arg} ${next}","messagePattern":"Setup AGENTS merge policy flags do not accept values: (.+?) (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/cli/index.ts","lineNumber":544,"sourceCode":"export type SetupMergeAgentsPolicyArg =\n  | { kind: \"set\"; value: boolean }\n  | { kind: \"clear\" }\n  | undefined;\n\nexport function resolveSetupAgentsMergePolicyArg(args: string[]): SetupMergeAgentsPolicyArg {\n  let policy: SetupMergeAgentsPolicyArg;\n  const setPolicy = (next: Exclude<SetupMergeAgentsPolicyArg, undefined>, source: string): void => {\n    if (policy && (policy.kind !== next.kind || (policy.kind === \"set\" && next.kind === \"set\" && policy.value !== next.value))) {\n      throw new Error(`Conflicting setup AGENTS merge policy flags: ${source} conflicts with another merge policy selector.`);\n    }\n    policy = next;\n  };\n  for (let index = 0; index < args.length; index += 1) {\n    const arg = args[index];\n    if (arg === \"--merge-agents\" || arg === \"--no-merge-agents\" || arg === \"--clear-merge-agents-policy\") {\n      const next = args[index + 1];\n      if (next && !next.startsWith(\"--\")) {\n        throw new Error(`Setup AGENTS merge policy flags do not accept values: ${arg} ${next}`);\n      }\n      if (arg === \"--merge-agents\") {\n        setPolicy({ kind: \"set\", value: true }, arg);\n      } else if (arg === \"--no-merge-agents\") {\n        setPolicy({ kind: \"set\", value: false }, arg);\n      } else {\n        setPolicy({ kind: \"clear\" }, arg);\n      }\n    } else if (\n      arg.startsWith(\"--merge-agents=\") ||\n      arg.startsWith(\"--no-merge-agents=\") ||\n      arg.startsWith(\"--clear-merge-agents-policy=\")\n    ) {\n      throw new Error(`Setup AGENTS merge policy flags do not accept values: ${arg}`);\n    }\n  }\n  return policy;\n}","sourceCodeStart":526,"sourceCodeEnd":562,"githubUrl":"https://github.com/Yeachan-Heo/oh-my-codex/blob/3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2/src/cli/index.ts#L526-L562","documentation":"The setup AGENTS merge policy flags are boolean switches and take no value. If the token immediately after one of `--merge-agents`, `--no-merge-agents`, `--clear-merge-agents-policy` is not another flag (doesn't start with `--`), the parser assumes you tried to give the switch a value and throws.","triggerScenarios":"`omx setup --merge-agents true` or `omx setup --no-merge-agents false` — any non-flag token directly following one of these flags.","commonSituations":"Habitually adding `=true`/` true` to boolean flags; scripts generated from config maps that always emit a value after each option.","solutions":["Remove the value: use the bare flag (e.g. `--merge-agents` not `--merge-agents true`)","Use the opposite flag to express false: `--no-merge-agents`","Reorder args so a positional value doesn't land right after a policy flag"],"exampleFix":"# before\nomx setup --merge-agents true\n\n# after\nomx setup --merge-agents","handlingStrategy":"validation","validationCode":"const BOOL_POLICY = ['--merge-agents', '--no-merge-agents', '--clear-merge-agents-policy'];\nfor (let i = 0; i < args.length; i++) {\n  if (BOOL_POLICY.includes(args[i])) {\n    const next = args[i + 1];\n    if (next && !next.startsWith('--')) {\n      console.error(`${args[i]} takes no value`);\n      process.exit(1);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try {\n  await main(args);\n} catch (e) {\n  if (/merge policy flags do not accept values/.test((e as Error).message)) {\n    // remove the stray value token and retry\n  } else throw e;\n}","preventionTips":["Treat these flags as boolean switches; never emit '=true' or a trailing value","Use --no-merge-agents to express false instead of '=false'"],"tags":["cli","argument-validation","boolean-flag-value"],"backgroundTag":"cli-flag-unexpected-value","analyzedSha":"3ad79a8a6fe6e95fdbb8c00e40716fffe4011ce2","analyzedAt":"2026-08-27T22:18:39.783Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}