{"record":{"id":"a6090444f8066fa6","repo":"affaan-m/ECC","slug":"unknown-argument-arg-a60904","errorCode":null,"errorMessage":"Unknown argument: ${arg}","messagePattern":"Unknown argument: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/install/request.js","lineNumber":85,"sourceCode":"    } else if (arg === '--locale') {\n      const locale = args[index + 1] || '';\n      if (!locale || locale.startsWith('--')) {\n        throw new Error('Missing value for --locale');\n      }\n      parsed.locale = locale;\n      index += 1;\n    } else if (arg === '--enable-hooks') {\n      parsed.enableHooks = true;\n    } else if (arg === '--no-hooks') {\n      parsed.noHooks = true;\n    } else if (arg === '--dry-run') {\n      parsed.dryRun = true;\n    } else if (arg === '--json') {\n      parsed.json = true;\n    } else if (arg === '--help' || arg === '-h') {\n      parsed.help = true;\n    } else if (arg.startsWith('--')) {\n      throw new Error(`Unknown argument: ${arg}`);\n    } else {\n      parsed.languages.push(arg);\n    }\n  }\n\n  return parsed;\n}\n\nfunction normalizeInstallRequest(options = {}) {\n  const config = options.config && typeof options.config === 'object'\n    ? options.config\n    : null;\n  const profileId = options.profileId || config?.profileId || null;\n  const target = options.target || config?.target || 'claude';\n  const moduleIds = validateInstallModuleIds(\n    dedupeStrings([...(config?.moduleIds || []), ...(options.moduleIds || [])])\n  );\n  const locale = options.locale || config?.locale || null;","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/install/request.js#L67-L103","documentation":"parseInstallArgs accepts a known set of flags and treats any bare token starting with `--` that is not recognized as an error. Any unknown double-dash argument throws 'Unknown argument: <arg>'. Non-flag tokens are collected as language names.","triggerScenarios":"Running the installer with an unrecognized flag such as `--locales` (plural), `--target-dir`, `--lang python`, or a typo like `--dry-run=true` when only bare `--dry-run` is supported.","commonSituations":"Typoed flag names; flags copied from a different tool's CLI; passing `--flag=value` syntax where the parser expects space-separated values or bare booleans; outdated docs referencing a removed flag.","solutions":["Run the installer with `--help` (`-h`) to list valid flags and correct the flag name.","Check for typos or plural/singular mismatches (e.g. `--locale` not `--locales`).","Use space-separated values instead of `=` syntax if that's the supported form.","If the flag existed in an older version, consult the changelog for its replacement."],"exampleFix":"// before\ninstall --locales zh-CN\n\n// after\ninstall --locale zh-CN","handlingStrategy":"validation","validationCode":"const KNOWN = new Set(['--target','--locale','--module','--include','--exclude','--profile','--enable-hooks','--no-hooks','--dry-run','--json','--help','-h']);\nconst unknown = argv.filter(a => a.startsWith('--') && !KNOWN.has(a));\nif (unknown.length) throw new Error(`Unknown flags: ${unknown.join(', ')}`);","typeGuard":"null","tryCatchPattern":"try {\n  const request = parseInstallArgs(argv);\n} catch (e) {\n  if (e.message.startsWith('Unknown argument')) {\n    console.error(`${e.message}. Run with --help to list valid flags.`);\n    process.exitCode = 2;\n    return;\n  }\n  throw e;\n}","preventionTips":["Check `--help` before using any flag you haven't used before.","Copy flag examples from current docs, not older tool versions.","Avoid `--flag=value` syntax unless documented; use space-separated values.","Lint shell scripts for flag typos against the known flag set."],"tags":["cli","argument-parsing","unknown-flag"],"backgroundTag":"invalid-cli-argument","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}