languagetool-org/languagetool · error · RuntimeException

Could not synthesize: " + infinitiveAsAnTkn + " with tag " +

Error message

Could not synthesize: " + infinitiveAsAnTkn + " with tag " + analyzedToken.getPOSTag()

What it means

SimpleReplaceVerbsRule.match tries to synthesize the infinitive replacement form of a Spanish verb via the synthesizer, rewriting 'haver' tags to auxiliary 'VA...' form. If synthesize throws IOException (no forms found for token+tag in the dictionary), it wraps it in a RuntimeException naming the infinitive and POSTag.

Source

Thrown at languagetool-language-modules/es/src/main/java/org/languagetool/rules/es/SimpleReplaceVerbsRule.java:185

        List<String> possibleReplacements = new ArrayList<>();
        String[] synthesized = null;
        List<String> replacementInfinitives = wrongWords.get(infinitive);
        for (String replacementInfinitive : replacementInfinitives) {
          if (replacementInfinitive.startsWith("(")) {
            possibleReplacements.add(replacementInfinitive);
          } else {
            String[] parts = replacementInfinitive.split(" "); // the first part
                                                               // is the verb
            AnalyzedToken infinitiveAsAnTkn = new AnalyzedToken(parts[0], "V.*", parts[0]);
            for (AnalyzedToken analyzedToken : analyzedTokenReadings) {
              try {
                String POSTag = analyzedToken.getPOSTag();
                if (infinitiveAsAnTkn.getLemma().equals("haver")) {
                  POSTag = "VA" + POSTag.substring(2);
                }
                synthesized = synth.synthesize(infinitiveAsAnTkn, POSTag);
              } catch (IOException e) {
                throw new RuntimeException(
                    "Could not synthesize: " + infinitiveAsAnTkn + " with tag " + analyzedToken.getPOSTag(), e);
              }
              for (String s : synthesized) {
                for (int j = 1; j < parts.length; j++) {
                  s = s.concat(" ").concat(parts[j]);
                }
                if (!possibleReplacements.contains(s)) {
                  possibleReplacements.add(s);
                }
              }
            }
          }
        }
        if (possibleReplacements.size() > 0) {
          RuleMatch potentialRuleMatch = createRuleMatch(tokenReadings, possibleReplacements, sentence, infinitive);
          ruleMatches.add(potentialRuleMatch);
        }
      }

View on GitHub (pinned to 2e990059ce)

Solutions

  1. Check the infinitive and tag in the message; verify both exist in the Spanish POS dictionary (image/spell .info + tagset).
  2. Correct the rule data so the replacement infinitive and its tag match dictionary entries.
  3. Rebuild/update the language dictionary if it is stale relative to the rule data.

Example fix

// before (rule data refers to verb missing from dictionary)
haver
// after (use dictionary-supported auxiliary)
haber
Defensive patterns

Strategy: try-catch

Try / catch

try {
  synthesized = synth.synthesize(infinitiveAsAnTkn, POSTag);
} catch (IOException e) {
  LOG.warn("No synthesis for '{}' tag '{}' — leaving original text unchanged", infinitiveAsAnTkn, POSTag);
  return super.match(...); // or skip replacement
}

Prevention

When it happens

Trigger: A Spanish verb-replacement rule produces an infinitive whose lemma is absent from the dictionary or whose POSTag combination has no inflected forms; synthesize([], ...) throws and match rethrows with context.

Common situations: Dictionary/tagset updates breaking a rule's expected tag; rule data referencing a verb form missing from the Spanish POS dictionary; 'haver' tag rewriting producing an inconsistent tag string.

Understand the failure class

Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.

Related errors


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