{"record":{"id":"1095dfb5d58e73a6","repo":"stanfordnlp/CoreNLP","slug":"invalid-classifier-label-for-isdone-argmax","errorCode":null,"errorMessage":"Invalid classifier label for isDone: \" + argmax","messagePattern":"Invalid classifier label for isDone: \" \\+ argmax","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/naturalli/ClauseSplitterSearchProblem.java","lineNumber":183,"sourceCode":"      this.edgeIndex = edgeToIndex.indexOf(edge);\n      this.subjectOrNull = source.subjectOrNull;\n      this.distanceFromSubj = source.distanceFromSubj;\n      this.objectOrNull = source.objectOrNull;\n      this.thunk = source.thunk;\n      this.isDone = isDone;\n    }\n\n    public SemanticGraph originalTree() {\n      return ClauseSplitterSearchProblem.this.tree;\n    }\n\n    public State withIsDone(ClauseClassifierLabel argmax) {\n      if (argmax == ClauseClassifierLabel.CLAUSE_SPLIT) {\n        isDone = true;\n      } else if (argmax == ClauseClassifierLabel.CLAUSE_INTERM) {\n        isDone = false;\n      } else {\n        throw new IllegalStateException(\"Invalid classifier label for isDone: \" + argmax);\n      }\n      return this;\n    }\n  }\n\n  /**\n   * An action being taken; that is, the type of clause splitting going on.\n   */\n  public interface Action {\n    /**\n     * The name of this action.\n     */\n    String signature();\n\n    /**\n     * A check to make sure this is actually a valid action to take, in the context of the given tree.\n     * @param originalTree The _original_ tree we are searching over. This is before any clauses are split off.\n     * @param edge The edge that we are traversing with this clause.","sourceCodeStart":165,"sourceCodeEnd":201,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/naturalli/ClauseSplitterSearchProblem.java#L165-L201","documentation":"State.withIsDone() accepts only the CLAUSE_SPLIT or CLAUSE_INTERM labels when updating a search state's isDone flag. Any other label (e.g. CLAUSE_NOT_MERGE or null) is unsupported for this transition, so the code fails fast with an IllegalStateException. It is an internal invariant check inside the clause-splitting search, not something callers normally control directly.","triggerScenarios":"Calling withIsDone with a ClauseClassifierLabel other than CLAUSE_SPLIT or CLAUSE_INTERM — typically CLAUSE_NOT_MERGE — or null, which can happen if the clause classifier's weight vector is empty/untrained and argmax resolution yields an unexpected label during search.","commonSituations":"Running ClauseSplitter/OpenIE with a missing, corrupt, or empty splitter model so the classifier's argmax returns a label the state machine doesn't handle; custom code that constructs classifier labels manually.","solutions":["Load a valid, trained clause splitter model so the classifier only emits CLAUSE_SPLIT/CLAUSE_INTERM/CLAUSE_NOT_MERGE appropriately.","Check the caller that computes the argmax label and ensure it maps all classifier outcomes to valid ClauseClassifierLabel values.","If you invoke withIsDone yourself, guard against null and map any label that is neither SPLIT nor INTERM to CLAUSE_NOT_MERGE instead."],"exampleFix":"// before\nstate.withIsDone(label);\n// after\nClauseClassifierLabel safe = label == null ? ClauseClassifierLabel.CLAUSE_NOT_MERGE : label;\nif (safe == ClauseClassifierLabel.CLAUSE_SPLIT || safe == ClauseClassifierLabel.CLAUSE_INTERM) {\n  state.withIsDone(safe);\n}","handlingStrategy":"validation","validationCode":"if (label != ClauseClassifierLabel.CLAUSE_SPLIT && label != ClauseClassifierLabel.CLAUSE_INTERM) {\n  throw new IllegalArgumentException(\"withIsDone requires SPLIT or INTERM, got: \" + label);\n}","typeGuard":"boolean isValidForIsDone(ClauseClassifierLabel l) { return l == ClauseClassifierLabel.CLAUSE_SPLIT || l == ClauseClassifierLabel.CLAUSE_INTERM; }","tryCatchPattern":"try {\n  state.withIsDone(label);\n} catch (IllegalStateException e) {\n  log.warn(\"Skipping invalid isDone label\", e);\n}","preventionTips":["Load a trained, valid splitter model so argmax labels are well-formed","Never pass null ClauseClassifierLabel values into the search state machine","Map all classifier outputs through an exhaustive switch before touching State"],"tags":["illegal-state","naturalli","clause-splitting","enum-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}