{"record":{"id":"af7c1c7d1d67e19e","repo":"stanfordnlp/CoreNLP","slug":"should-not-happen-projection-table-is-incomplet","errorCode":null,"errorMessage":"[should not happen!] Projection table is incomplete for \" + mono + \" : \" + type + \" on relation \" + input","messagePattern":"\\[should not happen!\\] Projection table is incomplete for \" \\+ mono \\+ \" : \" \\+ type \\+ \" on relation \" \\+ input","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/naturalli/Polarity.java","lineNumber":174,"sourceCode":"                return NaturalLogicRelation.COVER;\n            }\n          case ANTITONE:\n            switch (type) {\n              case NONE:\n              case MULTIPLICATIVE:\n                return NaturalLogicRelation.INDEPENDENCE;\n              case ADDITIVE:\n              case BOTH:\n                return NaturalLogicRelation.ALTERNATION;\n            }\n          case NONMONOTONE:\n          case INVALID:\n            return NaturalLogicRelation.INDEPENDENCE;\n        }\n      case INDEPENDENCE:\n        return NaturalLogicRelation.INDEPENDENCE;\n    }\n    throw new IllegalStateException(\"[should not happen!] Projection table is incomplete for \" + mono + \" : \" + type + \" on relation \" + input);\n  }\n\n  /**\n   * Project the given natural logic lexical relation on this word. So, for example, if we want to go up the\n   * Hypernymy hierarchy ({@link edu.stanford.nlp.naturalli.NaturalLogicRelation#FORWARD_ENTAILMENT}) on this word,\n   * then this function will tell you what relation holds between the new mutated fact and this fact.\n   *\n   * @param lexicalRelation The lexical relation we are applying to this word.\n   * @return The relation between the mutated sentence and the original sentence.\n   */\n  public NaturalLogicRelation projectLexicalRelation(NaturalLogicRelation lexicalRelation) {\n    return NaturalLogicRelation.byFixedIndex( projectionFunction[lexicalRelation.fixedIndex] );\n  }\n\n  /**\n   * If true, applying this lexical relation to this word creates a sentence which is entailed by the original sentence,\n   * Note that both this, and {@link Polarity#negatesTruth(NaturalLogicRelation)} can be false. If this is the case, then\n   * natural logic can neither verify nor disprove this mutation.","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/naturalli/Polarity.java#L156-L192","documentation":"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.","triggerScenarios":"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.","commonSituations":"Forked/patched CoreNLP where new natural-logic relations were added; reflection-built enum values; memory corruption is effectively the only other path.","solutions":["Add the missing mono/type/input case to the switch in Polarity.project so every combination returns a NaturalLogicRelation","Revert any local modifications to NaturalLogicRelation / MonotonicityType enums","File a bug with the exact mono, type, and input values from the message"],"exampleFix":"// after adding a new relation\n// add to the switch:\ncase NEW_RELATION: return NaturalLogicRelation.INDEPENDENCE;\n// before the throw in Polarity.project","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { rel = polarity.project(mono, type, input); } catch (IllegalStateException e) { rel = NaturalLogicRelation.INDEPENDENCE; /* or propagate as bug */ }","preventionTips":["Do not modify NaturalLogicRelation/MonotonicityType enums without extending the projection switch","Treat this exception as a library bug and file a report"],"tags":["java","illegal-state","switch-fallthrough"],"backgroundTag":"internal-invariant-violation","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}