SonarSource/sonarqube · critical
Failed to create temporary configuration directory [%s]
Error message
Failed to create temporary configuration directory [%s]
What it means
createElasticsearchConfDirectory creates the temporary ES conf directory with mkdirs(). If mkdirs() returns false (directory cannot be created — it already exists as a file, or parent is not writable), it logs and throws this IllegalStateException, aborting process launch because ES cannot start without a conf directory.
Source
Thrown at server/sonar-main/src/main/java/org/sonar/application/ProcessLauncherImpl.java:166
esInstallation.getEsJvmOptions().writeToJvmOptionFile(esInstallation.getJvmOptions());
storeElasticsearchLog4j2Properties(esInstallation);
}
private static void pruneElasticsearchConfDirectory(File confDir) {
try {
if (confDir.exists()) {
FileUtils2.deleteDirectory(confDir);
}
} catch (IOException e) {
throw new IllegalStateException("Could not delete Elasticsearch temporary conf directory", e);
}
}
private static void createElasticsearchConfDirectory(File confDir) {
if (!confDir.mkdirs()) {
String error = format("Failed to create temporary configuration directory [%s]", confDir.getAbsolutePath());
LOG.error(error);
throw new IllegalStateException(error);
}
}
private void setupElasticsearchSecurity(EsInstallation esInstallation) {
if (esInstallation.isSecurityEnabled()) {
EsKeyStoreCli keyStoreCli = EsKeyStoreCli.getInstance(esInstallation);
setupElasticsearchAuthentication(esInstallation, keyStoreCli);
setupElasticsearchHttpEncryption(esInstallation, keyStoreCli);
keyStoreCli.executeWith(this::launchJava);
}
}
private static void setupElasticsearchAuthentication(EsInstallation esInstallation, EsKeyStoreCli keyStoreCli) {
keyStoreCli.store(BOOTSTRAP_PASSWORD_PROPERTY_KEY, esInstallation.getBootstrapPassword());
String esConfPath = esInstallation.getConfDirectory().getAbsolutePath();View on GitHub (pinned to 184c821202)
Solutions
- Verify and fix write permissions/ownership on sonar.path.temp (chown -R sonarqube:sonarqube).
- Remove any non-directory file existing at the conf path and clear the temp directory while stopped.
- Check disk space and inode availability on the temp filesystem.
- Check SELinux/AppAudit policies if creation is still denied on a writable path.
Example fix
$ sudo systemctl stop sonarqube $ ls -la /opt/sonarqube/temp $ sudo chown -R sonarqube:sonarqube /opt/sonarqube/temp $ sudo systemctl start sonarqube
Defensive patterns
Strategy: validation
Validate before calling
File conf = new File(tempDir, "conf");
File parent = conf.getParentFile();
if (parent == null || !parent.canWrite() || (conf.exists() && !conf.isDirectory())) {
throw new IllegalStateException("Cannot create ES conf dir under: " + parent);
} Try / catch
try { launcher.launch(...); } catch (IllegalStateException e) { if (e.getMessage().startsWith("Failed to create temporary configuration")) { fixPermissionsAndRetry(); } } Prevention
- Ensure sonar.path.temp exists, is writable, and owned by the service user.
- Use writable persistent storage in containers for the temp path.
- Monitor free inodes/disk space on the temp volume.
When it happens
Trigger: writeConfFiles() -> createElasticsearchConfDirectory() where File.mkdirs() fails on the ES temp conf path: parent directory missing/unwritable, a file exists at the target path, or out of inodes/space.
Common situations: Read-only container filesystems; incorrect ownership of sonar.path.temp; a stale file where the conf directory should be; SELinux/AppArmor blocking directory creation.
Understand the failure class
Background: mkdir permission denied (EACCES): failed to create directory errors explained — this error's family across 32 libraries.
Related errors
- Directory could not be created
- Could not delete Elasticsearch temporary conf directory
- Could not copy file:
- Failed to write ES configuration files
- Cannot write Elasticsearch jvm options file
AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09).
Data as JSON: /api/errors/114b0294dc024888.
Report an issue: GitHub.