{"record":{"id":"c8cb699349224619","repo":"vuejs/vue-cli","slug":"couldn-t-parse-inline-options-json-e-message","errorCode":null,"errorMessage":"Couldn't parse inline options JSON: ${e.message}","messagePattern":"Couldn't parse inline options JSON: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/@vue/cli/lib/invoke.js","lineNumber":66,"sourceCode":"      `Cannot resolve plugin ${chalk.yellow(pluginName)} from package.json. ` +\n        `Did you forget to install it?`\n    )\n  }\n\n  const pluginGenerator = loadModule(`${id}/generator`, context)\n  if (!pluginGenerator) {\n    throw new Error(`Plugin ${id} does not have a generator.`)\n  }\n\n  // resolve options if no command line options (other than --registry) are passed,\n  // and the plugin contains a prompt module.\n  // eslint-disable-next-line prefer-const\n  let { registry, $inlineOptions, ...pluginOptions } = options\n  if ($inlineOptions) {\n    try {\n      pluginOptions = JSON.parse($inlineOptions)\n    } catch (e) {\n      throw new Error(`Couldn't parse inline options JSON: ${e.message}`)\n    }\n  } else if (!Object.keys(pluginOptions).length) {\n    let pluginPrompts = loadModule(`${id}/prompts`, context)\n    if (pluginPrompts) {\n      const prompt = inquirer.createPromptModule()\n\n      if (typeof pluginPrompts === 'function') {\n        pluginPrompts = pluginPrompts(pkg, prompt)\n      }\n      if (typeof pluginPrompts.getPrompts === 'function') {\n        pluginPrompts = pluginPrompts.getPrompts(pkg, prompt)\n      }\n      pluginOptions = await prompt(pluginPrompts)\n    }\n  }\n\n  const plugin = {\n    id,","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/vuejs/vue-cli/blob/7eb93c169c7520935252e2473387f923ef80d856/packages/@vue/cli/lib/invoke.js#L48-L84","documentation":"Thrown during `vue invoke` when the user passes inline options via the `--inlineOptions` (aliased as $inlineOptions) flag and the provided value is not valid JSON. The invoke command attempts JSON.parse on the string; on failure it wraps the parse error message and re-throws.","triggerScenarios":"Running `vue invoke <plugin> --inlineOptions '{useConfigFiles: true}'` where the JSON has unquoted keys, trailing commas, single quotes, or other syntax errors. JavaScript object literals are not valid JSON.","commonSituations":"Developer writes a JS object literal instead of strict JSON (single quotes, unquoted keys, trailing commas). Copy-pasting from documentation that uses JS shorthand notation.","solutions":["Use strict JSON syntax: double-quoted keys, double-quoted string values, no trailing commas.","Validate the JSON with a linter or `echo '<json>' | jq .` before running the command.","If options are complex, consider putting them in a file or using the interactive prompt instead."],"exampleFix":"# before\n$ vue invoke eslint --inlineOptions \"{lintOn: 'save'}\"\nError: Couldn't parse inline options JSON\n# after\n$ vue invoke eslint --inlineOptions '{\"lintOn\": \"save\"}'","handlingStrategy":"validation","validationCode":"function tryParseInlineOptions(str) {\n  try {\n    JSON.parse(str);\n    return true;\n  } catch (e) {\n    return false;\n  }\n}\n// before running the command:\nif ($inlineOptions && !tryParseInlineOptions($inlineOptions)) {\n  console.error('Inline options must be valid JSON. Use double quotes for keys and values.');\n}","typeGuard":null,"tryCatchPattern":"try {\n  pluginOptions = JSON.parse($inlineOptions);\n} catch (e) {\n  // provide a more helpful message with the exact parse location\n  throw new Error(`Invalid inline options JSON: ${e.message}. Ensure double-quoted keys/values and no trailing commas.`);\n}","preventionTips":["Use strict JSON: double-quoted keys, double-quoted strings, no trailing commas, no comments.","Validate inline JSON with `echo '<json>' | jq .` or node -e before running.","Prefer interactive prompts or config files for complex options."],"tags":["invoke","json","validation","command-line","options"],"backgroundTag":null,"analyzedSha":"7eb93c169c7520935252e2473387f923ef80d856","analyzedAt":"2026-08-13T10:13:37.803Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}