{"record":{"id":"16e5026dca4a79b6","repo":"languagetool-org/languagetool","slug":"cannot-read-file-dictfile-getabsolutepath","errorCode":null,"errorMessage":"Cannot read file: ${dictFile.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":192,"sourceCode":"            double freqZeroToOne = Math.log(freq) / maxFreqLog;  // spread number better over the range\n            normalizedFreq = (int) (freqZeroToOne * (FREQ_RANGES_IN-1));  // 0 to 255\n          }\n          if (normalizedFreq < 0 || normalizedFreq > 255) {\n            throw new RuntimeException(\"Frequency out of range (0-255): \" + normalizedFreq + \" in word \" + key);\n          }\n          // Convert integers 0-255 to ranges A-Z, and write output \n          String freqChar = Character.toString((char) (FIRST_RANGE_CODE + normalizedFreq*FREQ_RANGES_OUT/FREQ_RANGES_IN));\n          //add separator only in speller dictionaries\n          if (useSeparator) { \n            bw.write(line + separator + freqChar + \"\\n\");  \n          } else {\n            bw.write(line + freqChar + \"\\n\");\n          }\n        }\n      }\n      System.out.println(freqList.size() + \" frequency values applied to \" + freqValuesApplied + \" word forms.\");\n    } catch (IOException e) {\n      throw new RuntimeException(\"Cannot read file: \" + dictFile.getAbsolutePath());\n    }\n    return tempFile;\n  }\n  \n  protected File convertTabToSeparator(File inputFile) throws RuntimeException, IOException {\n    File outputFile = File.createTempFile(\n        DictionaryBuilder.class.getSimpleName() + \"_separator\", \".txt\");\n    outputFile.deleteOnExit();\n\n    String separator = getOption(\"fsa.dict.separator\");\n    if (separator == null || separator.trim().isEmpty()) {\n      throw new IOException(\n          \"A separator character (fsa.dict.separator) must be defined in the dictionary info file.\");\n    }\n    String encoding = getOption(\"fsa.dict.encoding\");\n    try (Scanner scanner = new Scanner(inputFile, encoding);\n         Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), encoding))) {\n      while (scanner.hasNextLine()) {","sourceCodeStart":174,"sourceCodeEnd":210,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-tools/src/main/java/org/languagetool/tools/DictionaryBuilder.java#L174-L210","documentation":"I/O guard in DictionaryBuilder.addFreqData: reading the (decompiled) dictionary file to re-embed frequency data failed; the input at fault is the dictFile being rewritten.","triggerScenarios":"Thrown at languagetool-tools/src/main/java/org/languagetool/tools/DictionaryBuilder.java:192 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify dictFile exists and is readable/writable","Check disk space and permissions in the output directory","Re-run the earlier build steps that produce dictFile if it was deleted"],"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-14T05:17:10.506Z"}