{"record":{"id":"10ad2a055358de03","repo":"Hmbown/CodeWhale","slug":"unknown-argument-arg","errorCode":null,"errorMessage":"unknown argument: ${arg}","messagePattern":"unknown argument: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"integrations/feishu-bridge/scripts/validate-config.mjs","lineNumber":72,"sourceCode":"      case \"--runtime-env\":\n        parsed.runtimeEnv = argv[++index];\n        break;\n      case \"--workspace-root\":\n        parsed.workspaceRoot = argv[++index];\n        break;\n      case \"--check-filesystem\":\n        parsed.checkFilesystem = true;\n        break;\n      case \"--json\":\n        parsed.json = true;\n        break;\n      case \"-h\":\n      case \"--help\":\n        printHelp();\n        process.exit(0);\n        break;\n      default:\n        throw new Error(`unknown argument: ${arg}`);\n    }\n  }\n  return parsed;\n}\n\nasync function appendFilesystemChecks(result, env, args) {\n  const workspace = cleanEnvValue(env.CODEWHALE_WORKSPACE ?? env.DEEPSEEK_WORKSPACE);\n  if (workspace) {\n    await checkReadableDirectory(result, workspace, \"workspace\");\n  }\n\n  const threadMapPath = cleanEnvValue(env.FEISHU_THREAD_MAP_PATH);\n  if (threadMapPath) {\n    const parent = path.dirname(threadMapPath);\n    await checkWritableDirectory(result, parent, \"thread map directory\");\n  }\n\n  if (args.env) {","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/433685b2024e7bc4c99e1e2e326bcad39b4d9d65/integrations/feishu-bridge/scripts/validate-config.mjs#L54-L90","documentation":"CLI parsing guard in parseArgs(): the validator was invoked with an argument not in its known set (--runtime-env, --workspace-root, --check-filesystem, --json, -h/--help). It fails fast on typos and unsupported flags rather than silently ignoring them, so config validation never runs against misunderstood options.","triggerScenarios":"Running `node integrations/feishu-bridge/scripts/validate-config.mjs` with a flag it does not recognize — misspellings like --envv, unsupported long options, or extra positional words.","commonSituations":"Copy-pasting flags from another script's docs; typo'd flag names; assuming the validator accepts the same flags as the bridge runtime itself.","solutions":["Run with --help to list the accepted arguments and use exactly those.","Fix the typo in the flag name (e.g. --env vs --envv).","Remove unexpected positional arguments; the validator takes flags only (env/app config come from the environment and config file)."],"exampleFix":"// before\nnode scripts/validate-config.mjs --env-file .env\n// after\nnode scripts/validate-config.mjs --env .env   # or check --help for exact flag","handlingStrategy":"validation","validationCode":"const KNOWN = ['--help', '-h', '--env', '--json'];\nconst unknown = process.argv.slice(2).filter(a => a.startsWith('-') && !KNOWN.includes(a));\nif (unknown.length) { console.error('unknown:', unknown); process.exit(1); }","typeGuard":"function isKnownFlag(arg) {\n  return ['-h', '--help', '--env', '--json'].includes(arg);\n}","tryCatchPattern":"try {\n  const args = parseArgs(process.argv.slice(2));\n} catch (e) {\n  if (String(e.message).startsWith('unknown argument')) {\n    printHelp();\n    process.exit(2);\n  }\n  throw e;\n}","preventionTips":["Run --help first when using the validator in new shells or CI scripts.","Keep flag names for the validator and the runtime bridge in a shared constant.","Add a lint/CI step that invokes the validator with its documented flags only."],"tags":["cli","argument-parsing","config-validation"],"backgroundTag":"invalid-cli-argument","analyzedSha":"433685b2024e7bc4c99e1e2e326bcad39b4d9d65","analyzedAt":"2026-09-15T12:24:24.634Z","contentChangedAt":"2026-09-15T12:24:24.634Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}