SonarSource/sonarqube · error · IllegalArgumentException
Property is not set
Error message
Property is not set
What it means
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.
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).
Example fix
// before
File home = props.nonNullValueAsFile("sonar.path.home");
// after
File home = new File(props.nonNullValue("sonar.path.data")).getParentFile(); // or set sonar.path.home in sonar.properties Defensive patterns
Strategy: validation
Validate before calling
if (props.value("sonar.path.home") == null) {
throw new IllegalStateException("sonar.path.home is not set; cannot resolve installation paths");
} Try / catch
try {
File home = props.nonNullValueAsFile("sonar.path.home");
} catch (IllegalArgumentException e) {
logger.error("Path property not configured: {}", e.getMessage());
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: Unpacked SonarQube distribution without conf/sonar.properties populated; JDBC driver path property expected but never set; tests building Props without path defaults.
Understand the failure class
Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.
Related errors
- Missing property:
- property need to be set when using elastic search…
- Property is mandatory
- Address in property is not a valid address
- allowAllGroups can only be enabled when Auto-provisioning…
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/b6d626493e0ddc3b.
Report an issue: GitHub.
Appendix: source
Thrown at server/sonar-process/src/main/java/org/sonar/process/Props.java:82
public String value(String key, @Nullable String defaultValue) {
String s = value(key);
return s == null ? defaultValue : s;
}
public boolean valueAsBoolean(String key) {
String s = value(key);
return s != null && Boolean.parseBoolean(s);
}
public boolean valueAsBoolean(String key, boolean defaultValue) {
String s = value(key);
return s != null ? Boolean.parseBoolean(s) : defaultValue;
}
public File nonNullValueAsFile(String key) {
String s = value(key);
if (s == null) {
throw new IllegalArgumentException("Property " + key + " is not set");
}
return new File(s);
}
@CheckForNull
public Integer valueAsInt(String key) {
String s = value(key);
if (s != null && !"".equals(s)) {
try {
return Integer.parseInt(s);
} catch (NumberFormatException e) {
throw new IllegalStateException("Value of property " + key + " is not an integer: " + s, e);
}
}
return null;
}
public int valueAsInt(String key, int defaultValue) {View on GitHub (pinned to 184c821202)