{"record":{"id":"e673709667a2ba53","repo":"Hmbown/CodeWhale","slug":"unknown-argument-arg-e67370","errorCode":null,"errorMessage":"unknown argument: ${arg}","messagePattern":"unknown argument: (.+?)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"integrations/telegram-bridge/scripts/validate-config.mjs","lineNumber":78,"sourceCode":"      case \"--workspace-root\":\n        parsed.workspaceRoot = argv[++index];\n        break;\n      case \"--check-filesystem\":\n        parsed.checkFilesystem = true;\n        break;\n      case \"--allow-remote-runtime\":\n        parsed.requireLocalRuntime = false;\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 = envFirst(env, \"CODEWHALE_WORKSPACE\", \"DEEPSEEK_WORKSPACE\");\n  if (workspace) {\n    await checkReadableDirectory(result, workspace, \"workspace\");\n  }\n\n  const threadMapPath = cleanEnvValue(env.TELEGRAM_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":60,"sourceCodeEnd":96,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/8880682c63083a91624de936797efa3ce9e498fd/integrations/telegram-bridge/scripts/validate-config.mjs#L60-L96","documentation":"The CLI argument parser in integrations/telegram-bridge/scripts/validate-config.mjs walks process.argv and recognizes only --allow-remote-runtime, --json, -h and --help. Any other token falls into the default case and throws `unknown argument: ${arg}` before any config or environment validation runs. It is a pure usage error: the message echoes back the exact offending token.","triggerScenarios":"Running `node scripts/validate-config.mjs` with a misspelled flag (--allow-remote, --verbose), a value passed as a separate positional (--json true), or an env-style argument (TELEGRAM_BOT_TOKEN=...).","commonSituations":"Copy-pasting a command line from another bridge's docs; passing flags that belong to src/index.mjs rather than the validator; shell aliases or scripts that append extra arguments.","solutions":["Run `node scripts/validate-config.mjs --help` to list the accepted flags, then correct the command line","Remove positional values — `--json` and `--allow-remote-runtime` are boolean flags that take no value","If extending the script, add the new case to the switch at validate-config.mjs:78 and keep printHelp in sync"],"exampleFix":"# before\nnode scripts/validate-config.mjs --json true\n# after\nnode scripts/validate-config.mjs --json","handlingStrategy":"validation","validationCode":"const ALLOWED = new Set(['--allow-remote-runtime', '--json', '-h', '--help']);\nconst offending = process.argv.slice(2).filter((a) => !ALLOWED.has(a));\nif (offending.length) {\n  console.error(`unsupported argument(s): ${offending.join(' ')} — see --help`);\n  process.exit(2);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const parsed = parseArgs(process.argv.slice(2));\n} catch (error) {\n  if (/^unknown argument:/.test(error.message)) {\n    printHelp();\n    process.exit(2);\n  }\n  throw error;\n}","preventionTips":["Drive both the parser switch and --help output from one flag whitelist","Never pass flag values as bare positionals; use the documented boolean/value forms"],"tags":["cli","arguments","validation","telegram-bridge"],"backgroundTag":null,"analyzedSha":"8880682c63083a91624de936797efa3ce9e498fd","analyzedAt":"2026-08-16T11:31:27.956Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}