{"record":{"id":"438600f654959328","repo":"nexu-io/open-design","slug":"unknown-flag-key-run-with-help-for-the-li","errorCode":null,"errorMessage":"unknown flag: --${key}. Run with --help for the list of accepted flags.","messagePattern":"unknown flag: --(.+?)\\. Run with --help for the list of accepted flags\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/daemon/src/cli.ts","lineNumber":1745,"sourceCode":"  const stringFlags = opts.string instanceof Set ? opts.string : new Set();\n  const booleanFlags = opts.boolean instanceof Set ? opts.boolean : new Set();\n  const knownFlags = new Set([...stringFlags, ...booleanFlags]);\n  // Positionals collected silently; callers that take `<id>` style\n  // positional args (e.g. `od plugin info <id>`) re-scan `argv`\n  // themselves to pick them up. Strict positional rejection here\n  // would break those commands, so we only enforce strict-flag\n  // semantics for things that *are* prefixed with `--`.\n  const out = {};\n  for (let i = 0; i < argv.length; i++) {\n    const a = argv[i];\n    if (!a || !a.startsWith('--')) {\n      // Positional — let the caller decide what to do with it.\n      continue;\n    }\n    const eq = a.indexOf('=');\n    const key = eq >= 0 ? a.slice(2, eq) : a.slice(2);\n    if (knownFlags.size > 0 && !knownFlags.has(key)) {\n      throw new Error(\n        `unknown flag: --${key}. Run with --help for the list of accepted flags.`,\n      );\n    }\n    if (eq >= 0) {\n      out[key] = a.slice(eq + 1);\n      continue;\n    }\n    if (booleanFlags.has(key)) {\n      out[key] = true;\n      continue;\n    }\n    if (stringFlags.has(key)) {\n      const next = argv[i + 1];\n      if (next == null) {\n        throw new Error(`flag --${key} requires a value`);\n      }\n      out[key] = next;\n      i++;","sourceCodeStart":1727,"sourceCodeEnd":1763,"githubUrl":"https://github.com/nexu-io/open-design/blob/5be4028344c2eb4c667c5a97bda8f750c5597ef7/apps/daemon/src/cli.ts#L1727-L1763","documentation":"Thrown by parseFlags when an argv token starts with '--' but its key is not in the union of the command's declared string and boolean flags. parseFlags is the shared CLI flag parser used by every `od` subcommand; each subcommand declares its known flags and the parser rejects anything else to catch typos and stale docs.","triggerScenarios":"Running an `od <subcommand>` with a flag that subcommand does not accept — e.g. `od automation create --shedule hourly:30` (typo), `od brand rebuild --force` (no such flag), or a flag meant for a different subcommand.","commonSituations":"Typos in flag names; using a flag from an older/newer version; copy-pasting a command from docs for a different subcommand; mixing long-form abbreviations that the parser does not support.","solutions":["Run `od <subcommand> --help` and copy the exact flag name from the accepted list.","Check for typos — the message echoes the unknown key.","Confirm the flag exists in the version of the daemon you are running (CLI surface was extended across releases).","If the flag genuinely should exist, add it to the subcommand's boolean/string flag set in cli.ts."],"exampleFix":"# before\nod automation create --shedule hourly:30\n# after\nod automation create --schedule hourly:30","handlingStrategy":"validation","validationCode":"// before invoking od, check the flags you pass are in the subcommand's help\nconst { stdout } = await run(['od', subcommand, '--help']);\nconst known = parseKnownFlags(stdout);\nfor (const flag of passedFlags) {\n  if (!known.has(flag)) throw new Error(`unknown flag: --${flag}`);\n}","typeGuard":null,"tryCatchPattern":"try { await runOd(args); }\ncatch (e) {\n  if (String(e.message).startsWith('unknown flag:')) {\n    // surface help to the user, suggest the closest known flag\n    suggestFlag(e.message);\n    return;\n  }\n  throw e;\n}","preventionTips":["Always cross-check flag names against `od <subcommand> --help`.","Watch for typos — the message echoes the unknown key.","Confirm the flag exists in the daemon version you target."],"tags":["cli","argument-parsing","flag-validation","automation"],"backgroundTag":null,"analyzedSha":"5be4028344c2eb4c667c5a97bda8f750c5597ef7","analyzedAt":"2026-08-12T12:03:58.812Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}