{"record":{"id":"3023c951c7d88f46","repo":"moeru-ai/airi","slug":"missing-value-for-optionname","errorCode":null,"errorMessage":"Missing value for `${optionName}`.","messagePattern":"Missing value for `(.+?)`\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/cap-vite/src/index.ts","lineNumber":54,"sourceCode":"  return fileURLToPath(new URL(`./vite-wrapper-config${wrapperExtension}`, import.meta.url))\n}\n\nfunction parseViteConfigLoader(value: string | undefined): 'bundle' | 'native' | 'runner' | undefined {\n  if (value === 'bundle' || value === 'native' || value === 'runner') {\n    return value\n  }\n\n  return undefined\n}\n\nfunction resolveConfigPath(cwd: string, value: string): string {\n  return resolve(cwd, value)\n}\n\nfunction readRequiredOptionValue(viteArgs: string[], index: number, optionName: string): string {\n  const value = viteArgs[index + 1]\n  if (!value) {\n    throw new Error(`Missing value for \\`${optionName}\\`.`)\n  }\n\n  return value\n}\n\nfunction parseConfigArg(viteArgs: string[], index: number, cwd: string): ParsedViteArg | null {\n  const arg = viteArgs[index]\n\n  // NOTICE: Vite only accepts one `--config` entrypoint. cap-vite consumes that slot\n  // for its wrapper config, then loads the user config from inside the wrapper.\n  if (arg === '--config' || arg === '-c') {\n    return {\n      baseConfigFile: resolveConfigPath(cwd, readRequiredOptionValue(viteArgs, index, '--config')),\n      consumedArgs: 2,\n      forwardedArgs: [],\n    }\n  }\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/moeru-ai/airi/blob/677329427f32468c74b17f3ec47eeca4e05bec65/packages/cap-vite/src/index.ts#L36-L72","documentation":"While scanning forwarded Vite args, readRequiredOptionValue reads the token after a value-taking flag such as --config/-c and throws when it is missing or falsy — i.e. the flag is the last argument before '--' or is followed by another flag position that evaluates empty.","triggerScenarios":"Running `cap-vite --config -- ios` or `cap-vite -c` where the option is last, so viteArgs[index + 1] is undefined; also an explicitly empty string value.","commonSituations":"Composing the command in a script that conditionally appends the config value but always emits the flag; copy-pasted command truncated the path.","solutions":["Supply the value: `cap-vite --config vite.mobile.config.ts -- ios`","In scripts, only emit `--config`/`-c` when a non-empty value exists to follow it","Prefer the `--config=<path>` form if the surrounding tooling supports it"],"exampleFix":"# before\n$ cap-vite --config -- ios   # Error: Missing value for `--config`.\n\n# after\n$ cap-vite --config vite.mobile.config.ts -- ios","handlingStrategy":"validation","validationCode":"// Before invoking, ensure every value-taking flag has a following non-flag token\nconst valueFlags = new Set(['--config', '-c'])\nfor (let i = 0; i < viteArgs.length; i++) {\n  if (valueFlags.has(viteArgs[i]) && !viteArgs[i + 1])\n    throw new Error(`Missing value for ${viteArgs[i]}`)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Emit `--config` only when a non-empty path is available in the same template","Smoke-test generated command lines before shipping scripts"],"tags":["cli","vite","arguments","option-value"],"backgroundTag":"missing-cli-option-value","analyzedSha":"677329427f32468c74b17f3ec47eeca4e05bec65","analyzedAt":"2026-08-18T17:29:58.153Z","contentChangedAt":"2026-08-18T17:29:58.153Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}