{"record":{"id":"825d3ecf3eb88a66","repo":"SonarSource/sonarqube","slug":"fail-to-load-file-825d3e","errorCode":null,"errorMessage":"Fail to load file: ","messagePattern":"Fail to load file: ","errorType":"exception","errorClass":"SonarException","httpStatus":null,"severity":"error","filePath":"sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java","lineNumber":217,"sourceCode":"\n    String filePath = bundleBase.replace('.', '/');\n    if (!\"en\".equals(locale.getLanguage())) {\n      filePath += \"_\" + locale.getLanguage();\n    }\n    filePath += \"/\" + filename;\n    InputStream input = classloader.getResourceAsStream(filePath);\n    if (input != null) {\n      result = readInputStream(filePath, input);\n    }\n    return result;\n  }\n\n  private static String readInputStream(String filePath, InputStream input) {\n    String result;\n    try {\n      result = IOUtils.toString(input, UTF_8);\n    } catch (IOException e) {\n      throw new SonarException(\"Fail to load file: \" + filePath, e);\n    } finally {\n      IOUtils.closeQuietly(input);\n    }\n    return result;\n  }\n\n  public Set<String> getPropertyKeys() {\n    return propertyToBundles.keySet();\n  }\n\n  public Locale getEffectiveLocale(Locale locale) {\n    Locale bundleLocale = ResourceBundle.getBundle(BUNDLE_PACKAGE + \"core\", locale, this.classloader, this.control).getLocale();\n    locale.getISO3Language();\n    return bundleLocale.getLanguage().isEmpty() ? Locale.ENGLISH : bundleLocale;\n  }\n\n  @CheckForNull\n  private static String formatMessage(@Nullable String message, Object... parameters) {","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/SonarSource/sonarqube/blob/184c821202192afc1c599fc912d0889b69fffa53/sonar-core/src/main/java/org/sonar/core/i18n/DefaultI18n.java#L199-L235","documentation":"SonarException raised in DefaultI18n.readInputStream when IOUtils.toString fails to read a localized L10n bundle file (the path derived from bundle base, language and filename) from the classloader. It means the resource was found but could not be read/decoded from the stream, typically an I/O problem in the plugin JAR; the failing path is included after the message prefix.","triggerScenarios":"Calling messageFromFile for a bundle file that exists but cannot be read (I/O error mid-read, stream closed, disk failure, or resource stream returning an erroring stream).","commonSituations":"Corrupted language-pack plugin jars; partially deployed l10n bundles; unreadable files on disk.","solutions":["Check the reported bundle file exists and is readable","Reinstall/repair the language pack plugin","Inspect the wrapped IOException cause","Verify UTF-8 encoding compatibility of the resource"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  String bundle = messageFromFile(path, input);\n} catch (SonarException e) {\n  LOG.warn(\"Failed to load i18n bundle {}\", filePath, e);\n  return defaultBundle;\n}","preventionTips":["Verify language pack plugins are fully deployed","Check bundle files exist and are readable before use","Keep UTF-8 encoding for all resource files"],"tags":["i18n","file-read","io"],"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-17T15:17:12.973Z"}