languagetool-org/languagetool · error · RuntimeException

Form has more than 1 modern form:" + line

Error message

Form has more than 1 modern form:" + line

What it means

In DativePluralsData.loadWords, the first field (the dative form) may carry a modern variant using ':' as a separator (form:formModern). If splitting on ':' yields more than two parts — meaning multiple modern forms were supplied — this RuntimeException names the whole line.

Source

Thrown at languagetool-language-modules/ga/src/main/java/org/languagetool/rules/ga/DativePluralsData.java:61

  private static Set<DativePluralsEntry> loadWords(String path) {
    Set<DativePluralsEntry> set = new HashSet<>();
    InputStream stream = JLanguageTool.getDataBroker().getFromRulesDirAsStream(path);
    try (Scanner scanner = new Scanner(stream, "utf-8")) {
      while (scanner.hasNextLine()) {
        String line = scanner.nextLine().trim();
        if (line.isEmpty() || line.charAt(0) == '#') {
          continue;
        }
        String[] parts = line.split(";");
        if (parts.length != 4) {
          throw new RuntimeException("Incorrect number of fields: " + line);
        }
        String form = parts[0];
        String formModern = null;
        if (form.contains(":")) {
          String[] forms = form.split(":");
          if (forms.length != 2) {
            throw new RuntimeException("Form has more than 1 modern form:" + line);
          }
          form = forms[0];
          formModern = forms[1];
        }
        String repl = parts[3];
        String replModern = null;
        if (repl.contains(":")) {
          String[] repls = repl.split(":");
          if (repls.length != 2) {
            throw new RuntimeException("Replacement has more than 1 modern form:" + line);
          }
          repl = repls[0];
          replModern = repls[1];
        }
        String lemma = parts[1];
        String lemmaModern = null;
        if (lemma.contains(":")) {
          String[] lemmata = lemma.split(":");

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Edit the offending line so the form field has at most one colon: exactly one original form and one modern form.
  2. If multiple modern forms exist, duplicate the line, one per modern form.
  3. Verify no stray colon exists elsewhere in the field (e.g. an abbreviation).
  4. Document the form:formModern convention in the data file header comment to prevent recurrence.

Example fix

// before
ceart:cearta:ceartai; ceart; m; N...
// after (one line per modern form)
ceart:cearta; ceart; m; N...
ceart:ceartai; ceart; m; N...
Defensive patterns

Strategy: validation

Validate before calling

String form = line.split(";")[0];
if (form.chars().filter(c -> c == ':').count() > 1)
  throw new IllegalStateException("multiple modern forms in: " + line);

Try / catch

try { loadWords(reader); } catch (RuntimeException e) { log.error("Fix line: " + e.getMessage()); }

Prevention

When it happens

Trigger: A data-file line whose form field contains two or more ':' characters (e.g. 'a:b:c'), so form.split(":").length != 2.

Common situations: Contributors adding several modern spellings in one line; typos leaving an extra colon; copying a multi-variant convention from another resource file.

Understand the failure class

Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.

Related errors


AI-assisted analysis of languagetool-org/languagetool@2e990059ce (2026-09-06). Data as JSON: /api/errors/35b7e2cb3378b1ea. Report an issue: GitHub.