{"record":{"id":"a10ed5e0cbcf4863","repo":"SonarSource/sonarqube","slug":"jvm-option-s-must-be-set-to-s-got-s","errorCode":null,"errorMessage":"JVM option '%s' must be set to '%s'. Got '%s'","messagePattern":"JVM option '(.+?)' must be set to '(.+?)'\\. Got '(.+?)'","errorType":"validation","errorClass":"MessageException","httpStatus":null,"severity":"error","filePath":"server/sonar-process/src/main/java/org/sonar/process/MinimumViableSystem.java","lineNumber":55,"sourceCode":"    checkWritableDir(System.getProperty(\"java.io.tmpdir\"));\n    return this;\n  }\n\n  // Visible for testing\n  void checkWritableDir(String tempPath) {\n    try {\n      File tempFile = File.createTempFile(\"check\", \"tmp\", new File(tempPath));\n      deleteQuietly(tempFile);\n    } catch (IOException e) {\n      throw new IllegalStateException(format(\"Temp directory is not writable: %s\", tempPath), e);\n    }\n  }\n\n  public MinimumViableSystem checkRequiredJavaOptions(Map<String, String> requiredJavaOptions) {\n    for (Map.Entry<String, String> entry : requiredJavaOptions.entrySet()) {\n      String value = System.getProperty(entry.getKey());\n      if (!CS.equals(value, entry.getValue())) {\n        throw new MessageException(format(\n          \"JVM option '%s' must be set to '%s'. Got '%s'\", entry.getKey(), entry.getValue(), StringUtils.defaultString(value)));\n      }\n    }\n    return this;\n  }\n}\n","sourceCodeStart":37,"sourceCodeEnd":62,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-process/src/main/java/org/sonar/process/MinimumViableSystem.java#L37-L62","documentation":"checkRequiredJavaOptions validates that required JVM system properties have exact expected values. A MessageException is thrown naming the property, the expected value, and the actual value when they mismatch.","triggerScenarios":"Starting a SonarQube process without the required JVM options (e.g. process-specific -D properties), or with values altered by wrappers/scripts.","commonSituations":"Launching a child process manually without the standard startup scripts; custom launcher dropping -D flags; conflicting JVM configs between versions.","solutions":["Start the process with the required -D JVM options exactly as documented","Verify with `jinfo`/`jcmd` or a debug print that System.getProperty(key) matches the expected value","Fix the launcher script that drops the flags"],"exampleFix":"// before\njava -jar sonar-application.jar\n// after\njava -Dprocess.index=1 -Dprocess.key=web -Djava.io.tmpdir=/tmp/sonar -jar sonar-application.jar","handlingStrategy":"validation","validationCode":"for (Map.Entry<String,String> e : required.entrySet()) {\n  if (!e.getValue().equals(System.getProperty(e.getKey()))) {\n    throw new IllegalStateException(\"JVM option \" + e.getKey() + \" must be \" + e.getValue());\n  }\n}","typeGuard":null,"tryCatchPattern":"try { mvs.checkRequiredJavaOptions(required); } catch (MessageException e) { LOGGER.error(e.getMessage()); throw e; }","preventionTips":["Launch processes via the provided standard scripts that set required -D flags","Document required JVM options for custom launchers","Log all system properties at startup for diagnosis"],"tags":["jvm","configuration","startup"],"backgroundTag":"missing-env-var","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}