{"record":{"id":"7aa679a0e05eab72","repo":"SonarSource/sonarqube","slug":"could-not-read-properties-from-file","errorCode":null,"errorMessage":"Could not read properties from file: ","messagePattern":"Could not read properties from file: ","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"server/sonar-process/src/main/java/org/sonar/process/ConfigurationUtils.java","lineNumber":51,"sourceCode":"\n  private ConfigurationUtils() {\n    // Utility class\n  }\n\n  static Props loadPropsFromCommandLineArgs(String[] args) {\n    if (args.length != 1) {\n      throw new IllegalArgumentException(\"Only a single command-line argument is accepted \" +\n        \"(absolute path to configuration file)\");\n    }\n\n    File propertyFile = new File(args[0]);\n    Properties properties = new Properties();\n    Reader reader = null;\n    try {\n      reader = new InputStreamReader(new FileInputStream(propertyFile), StandardCharsets.UTF_8);\n      properties.load(reader);\n    } catch (Exception e) {\n      throw new IllegalStateException(\"Could not read properties from file: \" + args[0], e);\n    } finally {\n      IOUtils.closeQuietly(reader);\n      deleteQuietly(propertyFile);\n    }\n    return new Props(properties);\n  }\n}\n","sourceCodeStart":33,"sourceCodeEnd":59,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/server/sonar-process/src/main/java/org/sonar/process/ConfigurationUtils.java#L33-L59","documentation":"After validating the argument count, loadPropsFromCommandLineArgs opens the property file as UTF-8 and loads it. Any exception during reading/parsing (FileNotFoundException, IOException, malformed properties) is wrapped in this IllegalStateException carrying the file path, with the original exception as cause.","triggerScenarios":"args[0] points to a file that does not exist or is unreadable; the file is deleted before reading (it is deleted afterwards by design, so a retry will always fail); IO error mid-read; malformed .properties content.","commonSituations":"Temp configuration directory wiped between process start and config load; running the process manually with a wrong path; two processes racing and one deleting the temp conf file; encoding corruption.","solutions":["Look at the caused-by exception to distinguish missing file vs IO error vs parse error","Restart SonarQube via its standard scripts so it regenerates the temporary configuration file","Pass the correct absolute path to an existing, readable properties file","Ensure only one process instance runs against the same temp conf location (no concurrent deletion)"],"exampleFix":"// before\njava org.sonar.process.Search /wrong/path/conf.properties\n// after\njava org.sonar.process.Search /opt/sonarqube/temp/conf/search.properties","handlingStrategy":"validation","validationCode":"File f = new File(args[0]);\nif (!f.isFile() || !f.canRead()) throw new IllegalStateException(\"Conf file missing/unreadable: \" + args[0]);","typeGuard":null,"tryCatchPattern":"try { Props p = ConfigurationUtils.loadPropsFromCommandLineArgs(args); } catch (IllegalStateException e) { log.error(\"{} cause={}\", e.getMessage(), e.getCause()); throw e; }","preventionTips":["Inspect the caused-by to distinguish missing file vs parse error","Regenerate the temp conf file by restarting via official scripts","Avoid concurrent processes sharing one temp conf location","Keep the temp directory on stable, non-cleanup-prone storage"],"tags":["process","properties","file-read","configuration"],"backgroundTag":"file-read-failed","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"}