{"record":{"id":"a3eff1bdcf56d683","repo":"elastic/elasticsearch","slug":"78-a3eff1","errorCode":"78","errorMessage":"encountered [%d] error%s parsing [%s]%s[%d]: encountered improperly formatted JVM option in [%s] on line number [%d]: [%s]%s","messagePattern":"encountered \\[(.+?)\\] error(.+?) parsing \\[(.+?)\\](.+?)\\[(.+?)\\]: encountered improperly formatted JVM option in \\[(.+?)\\] on line number \\[(.+?)\\]: \\[(.+?)\\](.+?)","errorType":"exception","errorClass":"UserException","httpStatus":null,"severity":"error","filePath":"distribution/tools/server-cli/src/main/java/org/elasticsearch/server/cli/JvmOptionsParser.java","lineNumber":128,"sourceCode":"                e.jvmOptionsFile(),\n                System.lineSeparator()\n            );\n            StringBuilder msg = new StringBuilder(errorMessage);\n            int count = 0;\n            for (final Map.Entry<Integer, String> entry : e.invalidLines().entrySet()) {\n                count++;\n                final String message = String.format(\n                    Locale.ROOT,\n                    \"[%d]: encountered improperly formatted JVM option in [%s] on line number [%d]: [%s]%s\",\n                    count,\n                    e.jvmOptionsFile(),\n                    entry.getKey(),\n                    entry.getValue(),\n                    System.lineSeparator()\n                );\n                msg.append(message);\n            }\n            throw new UserException(ExitCodes.CONFIG, msg.toString());\n        }\n    }\n\n    private List<String> jvmOptions(\n        ServerArgs args,\n        final Path config,\n        Path tmpDir,\n        final String esJavaOpts,\n        final Map<String, String> substitutions,\n        final Map<String, String> cliSysprops,\n        final MachineDependentHeap machineDependentHeap\n    ) throws InterruptedException, IOException, JvmOptionsFileParserException, UserException {\n\n        final List<String> jvmOptions = readJvmOptionsFiles(config);\n\n        if (esJavaOpts != null) {\n            jvmOptions.addAll(Arrays.stream(esJavaOpts.split(\"\\\\s+\")).filter(Predicate.not(String::isBlank)).toList());\n        }","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/distribution/tools/server-cli/src/main/java/org/elasticsearch/server/cli/JvmOptionsParser.java#L110-L146","documentation":"Thrown by JvmOptionsParser when one or more lines in a jvm.options file are malformed (caught as JvmOptionsFileParserException and rewrapped as UserException CONFIG). The message lists each invalid line with its file and line number.","triggerScenarios":"A line in config/jvm.options or a vendor jvm.options file does not conform to the expected JVM-option syntax — e.g. contains stray characters, is not a -D/-X/-XX flag, or has whitespace in the middle of an option.","commonSituations":"Manually editing jvm.options and introducing a typo; copy-pasting a multi-word value without quoting; a CI pipeline templating jvm.options that emits a blank/garbage line.","solutions":["Use the line number from the message to open jvm.options and inspect the exact offending line.","Ensure every non-comment, non-blank line is a single valid JVM flag (-D, -X, or -XX:...).","For values with spaces, use the appropriate JVM syntax (usually no spaces; use = for -D props).","Re-run after editing to confirm zero parse errors."],"exampleFix":"# jvm.options — before (line 42 malformed)\n-Xmx4g extra\n\n# after\n-Xmx4g","handlingStrategy":"validation","validationCode":"for (String line : Files.readAllLines(jvmOptionsFile)) {\n    String t = line.trim();\n    if (t.isEmpty() || t.startsWith(\"#\")) continue;\n    if (!t.startsWith(\"-D\") && !t.startsWith(\"-X\") && !t.startsWith(\"-XX:\")) {\n        throw new IllegalArgumentException(\"Invalid JVM option line: \" + line);\n    }\n}","typeGuard":null,"tryCatchPattern":"try {\n    parser.jvmOptions(args, config, tmpDir, envOptions, substitutions, cliSysprops, mdh);\n} catch (JvmOptionsFileParserException e) {\n    throw new UserException(ExitCodes.CONFIG, \"Fix jvm.options: \" + e.invalidLines());\n}","preventionTips":["Lint jvm.options changes: each non-blank, non-comment line must be a single JVM flag.","Avoid spaces inside option values; use = for -D properties.","Validate config in CI before deploying."],"tags":["jvm","jvm-options","config","parsing"],"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}