{"record":{"id":"b6d626493e0ddc3b","repo":"SonarSource/sonarqube","slug":"property-is-not-set","errorCode":null,"errorMessage":"Property  is not set","messagePattern":"Property  is not set","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"server/sonar-process/src/main/java/org/sonar/process/Props.java","lineNumber":82,"sourceCode":"  public String value(String key, @Nullable String defaultValue) {\n    String s = value(key);\n    return s == null ? defaultValue : s;\n  }\n\n  public boolean valueAsBoolean(String key) {\n    String s = value(key);\n    return s != null && Boolean.parseBoolean(s);\n  }\n\n  public boolean valueAsBoolean(String key, boolean defaultValue) {\n    String s = value(key);\n    return s != null ? Boolean.parseBoolean(s) : defaultValue;\n  }\n\n  public File nonNullValueAsFile(String key) {\n    String s = value(key);\n    if (s == null) {\n      throw new IllegalArgumentException(\"Property \" + key + \" is not set\");\n    }\n    return new File(s);\n  }\n\n  @CheckForNull\n  public Integer valueAsInt(String key) {\n    String s = value(key);\n    if (s != null && !\"\".equals(s)) {\n      try {\n        return Integer.parseInt(s);\n      } catch (NumberFormatException e) {\n        throw new IllegalStateException(\"Value of property \" + key + \" is not an integer: \" + s, e);\n      }\n    }\n    return null;\n  }\n\n  public int valueAsInt(String key, int defaultValue) {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-process/src/main/java/org/sonar/process/Props.java#L64-L100","documentation":"Props.nonNullValueAsFile resolves a property to a java.io.File and throws IllegalArgumentException when the property is not set at all (null). Unlike File handling errors, this fires purely on a missing configuration value, before any filesystem access.","triggerScenarios":"Calling props.nonNullValueAsFile(\"sonar.path.home\") (or data/log paths, or JDBC driver path for oracle/h2/postgresql via checkAndComplete) when the key is absent from the properties.","commonSituations":"Unpacked SonarQube distribution without conf/sonar.properties populated; JDBC driver path property expected but never set; tests building Props without path defaults.","solutions":["Define the path property in conf/sonar.properties (e.g. sonar.path.home=/opt/sonarqube).","Verify the property key name against the version's documentation, since path keys changed between versions.","Use valueAsFile-style lookup with a default if the path can be derived (e.g. relative to the installation root)."],"exampleFix":"// before\nFile home = props.nonNullValueAsFile(\"sonar.path.home\");\n// after\nFile home = new File(props.nonNullValue(\"sonar.path.data\")).getParentFile(); // or set sonar.path.home in sonar.properties","handlingStrategy":"validation","validationCode":"if (props.value(\"sonar.path.home\") == null) {\n  throw new IllegalStateException(\"sonar.path.home is not set; cannot resolve installation paths\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  File home = props.nonNullValueAsFile(\"sonar.path.home\");\n} catch (IllegalArgumentException e) {\n  logger.error(\"Path property not configured: {}\", e.getMessage());\n}","preventionTips":["Set all sonar.path.* properties explicitly in conf/sonar.properties.","After unpacking a distribution, never delete or rename the conf directory.","Document which JDBC driver path properties your database flavor requires."],"tags":["missing-property","configuration","file"],"backgroundTag":"missing-required-config-field","analyzedSha":"184c821202192afc1c599fc912d0889b69fffa53","analyzedAt":"2026-09-09T12:23:51.573Z","contentChangedAt":"2026-09-09T12:23:51.573Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}