{"record":{"id":"eef6fb6e67ef3b52","repo":"languagetool-org/languagetool","slug":"could-not-load-remote-rules-configuration-at-conf","errorCode":null,"errorMessage":"Could not load remote rules configuration at <configFile.getAbsolutePath()>","messagePattern":"Could not load remote rules configuration at <configFile\\.getAbsolutePath\\(\\)>","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"languagetool-core/src/main/java/org/languagetool/JLanguageTool.java","lineNumber":647,"sourceCode":"      if (transformed != original) {\n        rules.set(i, transformed);\n      }\n    }\n  }\n\n  public void activateRemoteRules(@Nullable File configFile) throws IOException {\n    List<RemoteRuleConfig> configs;\n    try {\n      if (configFile != null) {\n        configs = RemoteRuleConfig.load(configFile);\n      } else {\n        configs = Collections.emptyList();\n      }\n      activateRemoteRules(configs);\n    } catch (IOException e) {\n      throw new IOException(\"Could not load remote rules.\", e);\n    } catch (ExecutionException e) {\n      throw new IOException(\"Could not load remote rules configuration at \" + configFile.getAbsolutePath(), e);\n    }\n  }\n\n  public void activateRemoteRules(List<RemoteRuleConfig> configs) throws IOException {\n    // Apply A/B test filtering first - can affect which rules get enabled and thus disabled because of fallback settings\n    List<String> activeAbTestsForUser = userConfig.getAbTest();\n    List<RemoteRuleConfig> selectedConfigsByUserSettings = configs.stream()\n      .filter(config -> {\n        if (!userConfig.isPremium() && config.isPremium()) {\n          return false;\n        }\n        String excludeABTest = config.getOptions().get(\"excludeABTest\");\n        if (excludeABTest != null && activeAbTestsForUser != null &&\n          activeAbTestsForUser.stream().anyMatch(flag -> flag.matches(excludeABTest))) {\n          return false;\n        }\n        String activeRemoteRuleAbTest = config.getOptions().get(\"abtest\");\n        if (activeRemoteRuleAbTest != null && !activeRemoteRuleAbTest.trim().isEmpty()) {","sourceCodeStart":629,"sourceCodeEnd":665,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-core/src/main/java/org/languagetool/JLanguageTool.java#L629-L665","documentation":"The same activateRemoteRules(File) flow wraps ExecutionException from loading the remote-rule configuration as an IOException 'Could not load remote rules configuration at <path>'. Unlike [27] this comes from the ExecutionException branch, i.e. the asynchronous loading task failed while resolving/fetching the configuration.","triggerScenarios":"Calling activateRemoteRules(File) when the underlying config-loading future fails (ExecutionException): unreachable remote-rule endpoint, invalid credentials in the config, or any exception thrown inside the loader task.","commonSituations":"Remote rule server down or misconfigured URL in the config; network/firewall blocking the fetch in production; expired API credentials for third-party (e.g. AI) rule backends invoked via testThirdPartyAI paths.","solutions":["Unwrap the ExecutionException cause to see the loader's real failure.","Verify network reachability of the remote rule endpoint from the host.","Check credentials/keys inside the remote-rule configuration file are valid and current.","Add a fallback that runs without remote rules, or retry the activation on transient network errors."],"exampleFix":"// before\nlt.activateRemoteRules(new File(\"remote-rules.conf\")); // throws on network failure\n// after\ntry {\n  lt.activateRemoteRules(new File(\"remote-rules.conf\"));\n} catch (IOException e) {\n  logger.warn(\"Remote rules unavailable, continuing with local rules\", e);\n}","handlingStrategy":"fallback","validationCode":"// preflight the remote endpoint referenced by the config before activation\nHttpResponse<String> r = client.send(req, HttpResponse.BodyHandlers.ofString());\nif (r.statusCode() != 200) throw new IllegalStateException(\"remote rule endpoint unhealthy\");","typeGuard":null,"tryCatchPattern":"try {\n  lt.activateRemoteRules(configFile);\n} catch (IOException e) {\n  logger.warn(\"Remote rules unavailable (\" + e.getCause() + \"); using local rules only\");\n  // continue degraded\n}","preventionTips":["Add health checks for remote rule endpoints before startup.","Keep credentials in the config current and rotated safely.","Design deployments to run degraded without remote rules."],"tags":["remote-rules","network","execution-exception","config-loading"],"backgroundTag":"upstream-api-error","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}