{"record":{"id":"6478cfe106d4837a","repo":"stanfordnlp/CoreNLP","slug":"unknown-mode-mode","errorCode":null,"errorMessage":"Unknown mode  + mode","messagePattern":"Unknown mode  \\+ mode","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/semgraph/SemanticGraphFactory.java","lineNumber":264,"sourceCode":"        deps = gs.typedDependenciesEnhanced();\n        break;\n      case ENHANCED_PLUS_PLUS:\n        deps = gs.typedDependenciesEnhancedPlusPlus();\n        break;\n      case COLLAPSED_TREE:\n        deps = gs.typedDependenciesCollapsedTree();\n        break;\n      case COLLAPSED:\n        deps = gs.typedDependenciesCollapsed(includeExtras);\n        break;\n      case CCPROCESSED:\n        deps = gs.typedDependenciesCCprocessed(includeExtras);\n        break;\n      case BASIC:\n        deps = gs.typedDependencies(includeExtras);\n        break;\n      default:\n        throw new IllegalArgumentException(\"Unknown mode \" + mode);\n    }\n\n    if (filter != null) {\n      List<TypedDependency> depsFiltered = Generics.newArrayList();\n      for (TypedDependency td : deps) {\n        if (filter.test(td)) {\n          depsFiltered.add(td);\n        }\n      }\n      deps = depsFiltered;\n    }\n\n    // there used to be an if clause that filtered out the case of empty\n    // dependencies. However, I could not understand (or replicate) the error\n    // it alluded to, and it led to empty dependency graphs for very short fragments,\n    // which meant they were ignored by the RTE system. Changed. (pado)\n    // See also the SemanticGraph constructor.\n","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/semgraph/SemanticGraphFactory.java#L246-L282","documentation":"SemanticGraphFactory.makeFromTree throws IllegalArgumentException(\"Unknown mode \" + mode) when the SemanticGraphFactory.Mode switch has no case for the given mode; only supported dependency modes (e.g. COLLAPSED, CCPROCESSED, BASIC, ENHANCED...) are handled in the version in use.","triggerScenarios":"Calling makeFromTree/generateXxxDependencies with a Mode value not covered by the switch — typically ENHANCED or ENHANCED_PLUS_PLUS passed to an older parser version that predates those modes, or a custom/unknown Mode.","commonSituations":"Version mismatch: code compiled against a newer CoreNLP enum run on an older jar; reflective or config-driven mode selection supplying an invalid value.","solutions":["Use a supported SemanticGraphFactory.Mode constant matching your parser version (e.g. COLLAPSED, BASIC, CCPROCESSED)","Upgrade the Stanford CoreNLP jar if you need ENHANCED/ENHANCED_PLUS_PLUS modes","Log/validate the mode value from config before calling the factory"],"exampleFix":"// before\nSemanticGraph sg = SemanticGraphFactory.makeFromTree(tree, SemanticGraphFactory.Mode.ENHANCED, ...); // old jar\n// after\nSemanticGraph sg = SemanticGraphFactory.makeFromTree(tree, SemanticGraphFactory.Mode.COLLAPSED, ...);\n// or upgrade corenlp to a version supporting Mode.ENHANCED","handlingStrategy":"validation","validationCode":"Set<SemanticGraphFactory.Mode> supported = Set.of(Mode.BASIC, Mode.COLLPSED /* per version */); if (supported.contains(mode)) { makeFromTree(tree, mode, ...); }","typeGuard":null,"tryCatchPattern":"try { sg = SemanticGraphFactory.makeFromTree(tree, mode, extras, filter, null); } catch (IllegalArgumentException e) { sg = SemanticGraphFactory.generateCollapsedDependencies(tree); }","preventionTips":["Only use Mode constants known to exist in your CoreNLP version","Avoid config-driven mode strings without validation","Align code and jar versions (check ENHANCED support)"],"tags":["java","nlp","enum","version-mismatch"],"backgroundTag":"unsupported-enum-value","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"}