stanfordnlp/CoreNLP · error · IllegalStateException

[should not happen!] Projection table is incomplete for " +

Error message

[should not happen!] Projection table is incomplete for " + mono + " : " + type + " on relation " + input

What it means

Polarity.project looks up how a NaturalLogicRelation projects through a monotonicity/type combination in a hardcoded switch table. If the switch falls through without returning — i.e. the table lacks an entry for some mono/type/input combination — it throws IllegalStateException claiming the projection table is incomplete. With the shipped enum values this is unreachable and indicates an internal bug or modified enums.

Solutions

  1. Add the missing mono/type/input case to the switch in Polarity.project so every combination returns a NaturalLogicRelation
  2. Revert any local modifications to NaturalLogicRelation / MonotonicityType enums
  3. File a bug with the exact mono, type, and input values from the message

Example fix

// after adding a new relation
// add to the switch:
case NEW_RELATION: return NaturalLogicRelation.INDEPENDENCE;
// before the throw in Polarity.project
Defensive patterns

Strategy: try-catch

Try / catch

try { rel = polarity.project(mono, type, input); } catch (IllegalStateException e) { rel = NaturalLogicRelation.INDEPENDENCE; /* or propagate as bug */ }

Prevention

When it happens

Trigger: Calling Polarity.project(mono, type, input) with a combination missing from the switch — realistically only after adding a new Monotonicity, MonotonicityType, or NaturalLogicRelation constant without extending the table.

Common situations: Forked/patched CoreNLP where new natural-logic relations were added; reflection-built enum values; memory corruption is effectively the only other path.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10). Data as JSON: /api/errors/af7c1c7d1d67e19e. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/naturalli/Polarity.java:174

                return NaturalLogicRelation.COVER;
            }
          case ANTITONE:
            switch (type) {
              case NONE:
              case MULTIPLICATIVE:
                return NaturalLogicRelation.INDEPENDENCE;
              case ADDITIVE:
              case BOTH:
                return NaturalLogicRelation.ALTERNATION;
            }
          case NONMONOTONE:
          case INVALID:
            return NaturalLogicRelation.INDEPENDENCE;
        }
      case INDEPENDENCE:
        return NaturalLogicRelation.INDEPENDENCE;
    }
    throw new IllegalStateException("[should not happen!] Projection table is incomplete for " + mono + " : " + type + " on relation " + input);
  }

  /**
   * Project the given natural logic lexical relation on this word. So, for example, if we want to go up the
   * Hypernymy hierarchy ({@link edu.stanford.nlp.naturalli.NaturalLogicRelation#FORWARD_ENTAILMENT}) on this word,
   * then this function will tell you what relation holds between the new mutated fact and this fact.
   *
   * @param lexicalRelation The lexical relation we are applying to this word.
   * @return The relation between the mutated sentence and the original sentence.
   */
  public NaturalLogicRelation projectLexicalRelation(NaturalLogicRelation lexicalRelation) {
    return NaturalLogicRelation.byFixedIndex( projectionFunction[lexicalRelation.fixedIndex] );
  }

  /**
   * If true, applying this lexical relation to this word creates a sentence which is entailed by the original sentence,
   * Note that both this, and {@link Polarity#negatesTruth(NaturalLogicRelation)} can be false. If this is the case, then
   * natural logic can neither verify nor disprove this mutation.

View on GitHub (pinned to 1b7edd19c4)