languagetool-org/languagetool · error · RuntimeException

Replacement has more than 1 modern form:" + line

Error message

Replacement has more than 1 modern form:" + line

What it means

Same convention as the form field: in DativePluralsData.loadWords the fourth field (the replacement) may encode one modern variant as repl:replModern. More than one colon in that field yields more than two parts and throws this RuntimeException with the offending line.

Source

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

        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(":");
          if (lemmata.length != 2) {
            throw new RuntimeException("Lemma has more than 1 modern form:" + line);
          }
          lemma = lemmata[0];
          lemmaModern = lemmata[1];
        }
        DativePluralsEntry entry = new DativePluralsEntry(form, lemma, parts[2], repl);
        if (formModern != null) {
          entry.setModernised(formModern);
        }

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Fix the line so the replacement field has at most one colon (original:modern).
  2. Split multiple replacement variants into separate lines.
  3. Grep the resource file for lines with two+ colons in the last field to fix all occurrences at once.
  4. Extend the parser explicitly if multiple modern replacements are genuinely required, with a corresponding format change to all lines.

Example fix

// before
...; ...; ...; breis:breise:breisí
// after
...; ...; ...; breis:breise
Defensive patterns

Strategy: validation

Validate before calling

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

Try / catch

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

Prevention

When it happens

Trigger: A data-file line whose fourth (replacement) field contains two or more ':' characters, so repls.length != 2.

Common situations: Manual data entry adding multiple replacement variants; stray colon typos; misunderstanding of the single-modern-form convention.

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/832cc1ed6df37d85. Report an issue: GitHub.