Hmbown/CodeWhale · warning · Error
unknown argument: ${arg}
Error message
unknown argument: ${arg} What it means
validate-config.mjs walks argv against a fixed switch (--check-filesystem, --json, -h/--help, and the earlier declared flags); anything else - a typo, an unquoted value splitting into two tokens, or a flag renamed between versions - reaches the default case and throws `unknown argument: <arg>`.
Source
Thrown at integrations/feishu-bridge/scripts/validate-config.mjs:72
case "--runtime-env":
parsed.runtimeEnv = argv[++index];
break;
case "--workspace-root":
parsed.workspaceRoot = argv[++index];
break;
case "--check-filesystem":
parsed.checkFilesystem = true;
break;
case "--json":
parsed.json = true;
break;
case "-h":
case "--help":
printHelp();
process.exit(0);
break;
default:
throw new Error(`unknown argument: ${arg}`);
}
}
return parsed;
}
async function appendFilesystemChecks(result, env, args) {
const workspace = cleanEnvValue(env.CODEWHALE_WORKSPACE ?? env.DEEPSEEK_WORKSPACE);
if (workspace) {
await checkReadableDirectory(result, workspace, "workspace");
}
const threadMapPath = cleanEnvValue(env.FEISHU_THREAD_MAP_PATH);
if (threadMapPath) {
const parent = path.dirname(threadMapPath);
await checkWritableDirectory(result, parent, "thread map directory");
}
if (args.env) {View on GitHub (pinned to 8880682c63)
Solutions
- Run with -h/--help to print the accepted flags
- Correct the flag spelling and quote values that may contain spaces
- Update scripts still passing flags from an older revision
Example fix
# before node scripts/validate-config.mjs --check-fs --json # after node scripts/validate-config.mjs --check-filesystem --json
Defensive patterns
Strategy: validation
Validate before calling
// mirror the switch cases in validate-config.mjs and keep them in sync
const ALLOWED = new Set(['--check-env', '--check-filesystem', '--json', '-h', '--help']);
for (const arg of process.argv.slice(2)) {
if (!ALLOWED.has(arg)) {
printHelp();
console.error(`unknown argument: ${arg}`);
process.exit(2);
}
} Prevention
- Run the script with --help when in doubt about flags
- Quote shell arguments that may contain spaces
- Update docs and CI invocations together when flags change
When it happens
Trigger: Running the validator with a misspelled flag (e.g. --check-fs), passing a positional argument, or shell expansion injecting extra tokens.
Common situations: Copy-pasted commands from outdated docs; CI scripts referencing flags renamed in a newer revision; unquoted env-derived values.
Related errors
- Usage: node scripts/release/assemble-release-assets.js INP
- Usage: node scripts/release/ensure-release-assets-absent.js
- unavailable credential
- Secret storage write failed for {slot}: {err}. Refusing to w
- {error}; additionally could not verify secret-store rollback
AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16).
Data as JSON: /api/errors/10ad2a055358de03.
Report an issue: GitHub.