SonarSource/sonarqube · error · MessageException

Unable to configure: . File specified in [] does not exist

Error message

Unable to configure: . File specified in [] does not exist

What it means

After confirming a store path property is set, getFileNameFromPathProperty checks that the referenced file exists. If Paths.get(...).toFile().exists() is false it throws this MessageException including the property key and the configured path.

Source

Thrown at server/sonar-main/src/main/java/org/sonar/application/es/EsSettings.java:152

        builder.put("xpack.security.http.ssl.enabled", Boolean.TRUE.toString());
        builder.put("xpack.security.http.ssl.keystore.path", clusterESHttpKeystoreFileName);
      }
    } else {
      builder.put("xpack.security.autoconfiguration.enabled", Boolean.FALSE.toString());
      builder.put("xpack.security.enabled", Boolean.FALSE.toString());
    }
  }

  private String getFileNameFromPathProperty(ProcessProperties.Property processProperty) {
    String processPropertyPath = props.value(processProperty.getKey());

    if (processPropertyPath == null) {
      throw new MessageException(processProperty.getKey() + " property need to be set " +
        "when using elastic search authentication");
    }
    Path path = Paths.get(processPropertyPath);
    if (!path.toFile().exists()) {
      throw new MessageException("Unable to configure: " + processProperty.getKey() + ". "
        + "File specified in [" + processPropertyPath + "] does not exist");
    }
    if (!path.toFile().canRead()) {
      throw new MessageException("Unable to configure: " + processProperty.getKey() + ". "
        + "Could not get read access to [" + processPropertyPath + "]");
    }
    return path.getFileName().toString();
  }

  private void configureNetwork(Map<String, String> builder) {
    if (!clusterEnabled) {
      InetAddress searchHost = resolveAddress(SEARCH_HOST);
      int searchPort = Integer.parseInt(props.nonNullValue(SEARCH_PORT.getKey()));
      builder.put(ES_HTTP_HOST_KEY, searchHost.getHostAddress());
      builder.put(ES_HTTP_PORT_KEY, valueOf(searchPort));
      builder.put("discovery.type", "single-node");

      int transportPort = Integer.parseInt(props.nonNullValue(ES_PORT.getKey()));

View on GitHub (pinned to 184c821202)

Solutions

  1. Create/copy the keystore or truststore file to the exact path given in the property
  2. Fix the property value to the correct absolute path of the existing file
  3. Ensure the file was deployed to every node of the cluster, not just the first
  4. Use absolute paths to avoid ambiguity about the process working directory

Example fix

# before
sonar.cluster.es.ssl.keystore.path=/etc/sonarqube/keystore.p12   # file absent
# after
ls /etc/sonarqube/ssl/keystore.p12  # ensure present
sonar.cluster.es.ssl.keystore.path=/etc/sonarqube/ssl/keystore.p12
Defensive patterns

Strategy: validation

Validate before calling

String p = props.get("sonar.cluster.es.ssl.keystore.path");
if (p != null && !new File(p).isFile()) throw new IllegalStateException("ES keystore file missing: " + p);

Try / catch

try { esSettings.build(); } catch (MessageException e) { log.error("ES store file missing: {}", e.getMessage()); throw new ConfigurationException(e); }

Prevention

When it happens

Trigger: sonar.cluster.es.ssl.keystore.path / truststore.path / http.keystore.path points to a file that does not exist on the node (typo, wrong absolute path, file not copied to this cluster node).

Common situations: Certificates generated on one node but not distributed to others; relative paths interpreted against the wrong working directory; keystore deleted or renamed after config was written.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of SonarSource/sonarqube@184c821202 (2026-09-09). Data as JSON: /api/errors/2d4b1a4b0192ce11. Report an issue: GitHub.