elastic/elasticsearch · error · IllegalArgumentException

numInputWords must be > 0 (got {numInputWords})

Error message

numInputWords must be > 0 (got {numInputWords})

What it means

Error "numInputWords must be > 0 (got {numInputWords})" thrown in elastic/elasticsearch.

Source

Thrown at modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/ESSynonymMapBuilder.java:66

    private final CircuitBreaker circuitBreaker;
    private int ruleCount = 0;

    private static class MapEntry {
        boolean includeOrig;
        final IntList ords = new IntList();
    }

    ESSynonymMapBuilder(boolean dedup, CircuitBreaker circuitBreaker) {
        this.dedup = dedup;
        this.circuitBreaker = circuitBreaker;
    }

    void add(CharsRef input, CharsRef output, boolean includeOrig) {
        int numInputWords = countWords(input);
        int numOutputWords = countWords(output);

        if (numInputWords <= 0) {
            throw new IllegalArgumentException("numInputWords must be > 0 (got " + numInputWords + ")");
        }
        if (input.length <= 0) {
            throw new IllegalArgumentException("input.length must be > 0 (got " + input.length + ")");
        }
        if (numOutputWords <= 0) {
            throw new IllegalArgumentException("numOutputWords must be > 0 (got " + numOutputWords + ")");
        }
        if (output.length <= 0) {
            throw new IllegalArgumentException("output.length must be > 0 (got " + output.length + ")");
        }

        if ((ruleCount++ & ADD_CHECK_INTERVAL) == 0) {
            circuitBreaker.addEstimateBytesAndMaybeBreak(0L, "Synonyms");
        }

        assert !hasHoles(input) : "input has holes: " + input;
        assert !hasHoles(output) : "output has holes: " + output;

View on GitHub (pinned to db6a809a66)

When it happens

Trigger: Thrown at modules/analysis-common/src/main/java/org/elasticsearch/analysis/common/ESSynonymMapBuilder.java:66 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of elastic/elasticsearch@db6a809a66 (2026-08-12). Data as JSON: /api/errors/ccb027582d7ddd6c. Report an issue: GitHub.