moeru-ai/airi · error · Error
Missing value for ` `.
Error message
Missing value for `${optionName}`. What it means
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.
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
Example fix
# before $ cap-vite --config -- ios # Error: Missing value for `--config`. # after $ cap-vite --config vite.mobile.config.ts -- ios
Defensive patterns
Strategy: validation
Validate before calling
// Before invoking, ensure every value-taking flag has a following non-flag token
const valueFlags = new Set(['--config', '-c'])
for (let i = 0; i < viteArgs.length; i++) {
if (valueFlags.has(viteArgs[i]) && !viteArgs[i + 1])
throw new Error(`Missing value for ${viteArgs[i]}`)
} Prevention
- Emit `--config` only when a non-empty path is available in the same template
- Smoke-test generated command lines before shipping scripts
When it happens
Trigger: 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.
Common situations: Composing the command in a script that conditionally appends the config value but always emits the flag; copy-pasted command truncated the path.
Related errors
- cap-vite [vite args...] -- <ios|android> [cap run args...]
- The first `cap run` argument must be `ios` or `android`.
- The first `cap run` argument must be `ios` or `android`.
- Unsupported capture format
- Unsupported route path
AI-assisted analysis of moeru-ai/airi@677329427f (2026-08-18).
Data as JSON: /api/errors/3023c951c7d88f46.
Report an issue: GitHub.
Appendix: source
Thrown at packages/cap-vite/src/index.ts:54
return fileURLToPath(new URL(`./vite-wrapper-config${wrapperExtension}`, import.meta.url))
}
function parseViteConfigLoader(value: string | undefined): 'bundle' | 'native' | 'runner' | undefined {
if (value === 'bundle' || value === 'native' || value === 'runner') {
return value
}
return undefined
}
function resolveConfigPath(cwd: string, value: string): string {
return resolve(cwd, value)
}
function readRequiredOptionValue(viteArgs: string[], index: number, optionName: string): string {
const value = viteArgs[index + 1]
if (!value) {
throw new Error(`Missing value for \`${optionName}\`.`)
}
return value
}
function parseConfigArg(viteArgs: string[], index: number, cwd: string): ParsedViteArg | null {
const arg = viteArgs[index]
// NOTICE: Vite only accepts one `--config` entrypoint. cap-vite consumes that slot
// for its wrapper config, then loads the user config from inside the wrapper.
if (arg === '--config' || arg === '-c') {
return {
baseConfigFile: resolveConfigPath(cwd, readRequiredOptionValue(viteArgs, index, '--config')),
consumedArgs: 2,
forwardedArgs: [],
}
}
View on GitHub (pinned to 677329427f)