{"record":{"id":"eef078ad885eaf0c","repo":"languagetool-org/languagetool","slug":"cannot-read-file-freqlistfile-getabsolutepath","errorCode":null,"errorMessage":"Cannot read file: ${freqListFile.getAbsolutePath()}","messagePattern":"Cannot read file: (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-tools/src/main/java/org/languagetool/tools/DictionaryBuilder.java","lineNumber":141,"sourceCode":"  protected boolean isOptionTrue(String option) {\n    return hasOption(option) && \"true\".equals(getOption(option));\n  }\n  \n  protected void readFreqList(File freqListFile) {\n    try (\n      FileInputStream fis = new FileInputStream(freqListFile.getAbsoluteFile());\n      InputStreamReader reader = new InputStreamReader(fis, StandardCharsets.UTF_8);\n      BufferedReader br = new BufferedReader(reader)\n    ) {\n      String line;\n      while ((line = br.readLine()) != null) {\n        Matcher m = pFreqEntry.matcher(line);\n        if (m.matches()) {\n          freqList.put(m.group(3), Integer.parseInt(m.group(1)));\n        }\n      }\n    } catch (IOException e) {\n      throw new RuntimeException(\"Cannot read file: \" + freqListFile.getAbsolutePath());\n    }\n  }\n  \n  protected File addFreqData(File dictFile, boolean useSeparator) throws IOException {\n    if (!isOptionTrue(\"fsa.dict.frequency-included\")) {\n      throw new IOException(\"In order to use frequency data add the line 'fsa.dict.frequency-included=true' to the dictionary info file.\");\n    }\n    String separator = getOption(\"fsa.dict.separator\");\n    if (separator == null || separator.trim().isEmpty()) {\n      throw new IOException(\"A separator character (fsa.dict.separator) must be defined in the dictionary info file.\");\n    }\n    File tempFile = File.createTempFile(DictionaryBuilder.class.getSimpleName(), \"WithFrequencies.txt\");\n    tempFile.deleteOnExit();\n    String encoding = getOption(\"fsa.dict.encoding\");\n    int freqValuesApplied = 0;\n\n    try (BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tempFile.getAbsoluteFile()), encoding));\n         BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(dictFile.getAbsoluteFile()), encoding))) {","sourceCodeStart":123,"sourceCodeEnd":159,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-tools/src/main/java/org/languagetool/tools/DictionaryBuilder.java#L123-L159","documentation":"I/O guard in DictionaryBuilder.readFreqList: opening or reading the frequency list file failed (missing file, permission issue, or read error), so the word-frequency map cannot be populated.","triggerScenarios":"Thrown at languagetool-tools/src/main/java/org/languagetool/tools/DictionaryBuilder.java:141 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the frequency list file path passed to the builder","Check file readability and encoding (UTF-8 expected)","Ensure the file is present on the machine running the build"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}