{"record":{"id":"8de569e818d22906","repo":"languagetool-org/languagetool","slug":"invalid-line-in-expected-rule-id-float-value","errorCode":null,"errorMessage":"Invalid line in , expected 'RULE_ID,float_value[,...]': ","messagePattern":"Invalid line in , expected 'RULE_ID,float_value\\[,\\.\\.\\.\\]': ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"languagetool-server/src/main/java/org/languagetool/server/ConfidenceMapLoader.java","lineNumber":67,"sourceCode":"      if (!Paths.get(fileName).toFile().exists()) {\n        continue;\n      }\n      List<String> lines = Files.readAllLines(Paths.get(fileName), UTF_8);\n      for (String line : lines) {\n        if (line.startsWith(\"#\")) {\n          continue;\n        }\n        String[] parts = line.split(\",\");\n        if (parts.length >= 2) {   // there might be more columns for better debugging, but we don't use them here\n          try {\n            float confidence = Float.parseFloat(parts[1]);\n            confMap.put(new ConfidenceKey(lang, parts[0]), confidence);\n            loadCount++;\n          } catch (NumberFormatException e) {\n            throw new RuntimeException(\"Invalid confidence float value in \" + fileName + \", expected 'RULE_ID,float_value[,...]': \" + line);\n          }\n        } else {\n          throw new RuntimeException(\"Invalid line in \" + fileName + \", expected 'RULE_ID,float_value[,...]': \" + line);\n        }\n      }\n      logger.info(\"Loaded \" + loadCount + \" mappings for \" + lang + \" from confidence map for rules from \" + fileName);\n    }\n    if (confMap.size() == 0) {\n      throw new RuntimeException(\"No confidence values could be loaded for \" + filePattern +\n        \" -- please check there are actually files that match this pattern\");\n    }\n    return confMap;\n  }\n\n}\n","sourceCodeStart":49,"sourceCodeEnd":80,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-server/src/main/java/org/languagetool/server/ConfidenceMapLoader.java#L49-L80","documentation":"Confidence map lines must contain at least two columns ('RULE_ID,float_value[,...]'). If a non-empty line yields fewer than two tab-separated parts, load throws a RuntimeException naming the file and the line.","triggerScenarios":"A confidence file contains a line with only a rule ID ('MY_RULE'), a blank-ish line, or a line using the wrong separator (space/comma instead of tab) so no second column is found.","commonSituations":"Manually edited files missing the value column; exporting CSV instead of the tab-separated format the loader expects; trailing header lines left in the file.","solutions":["Give every line a second, tab-separated float column: 'RULE_ID<tab>0.8'.","Check that fields are separated by tabs, not commas or spaces.","Delete header, comment, or empty lines that do not match the format.","Verify which file the message names and fix that language's file."],"exampleFix":"// before\nMY_RULE\n// after\nMY_RULE\t0.8","handlingStrategy":"validation","validationCode":"for (const line of lines) {\n  if (line.split('\\t').length < 2) throw new Error('Line needs RULE_ID and float value: ' + line);\n}","typeGuard":"function hasTwoColumns(line) { return line.split('\\t').length >= 2; }","tryCatchPattern":"try {\n  Map<ConfidenceKey,Float> map = new ConfidenceMapLoader().load(filePattern);\n} catch (RuntimeException e) {\n  logger.error(\"Confidence map line invalid: \" + e.getMessage());\n}","preventionTips":["Generate files with tab separators, not CSV.","Remove header or blank lines from confidence files.","Add a format check script to the deployment pipeline."],"tags":["config","parsing","languagetool"],"backgroundTag":"invalid-config-value","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"}