stanfordnlp/CoreNLP · error · IllegalArgumentException

CoNLLUOutputter: unknown dependencies type " +…

Error message

CoNLLUOutputter: unknown dependencies type " + dependenciesType

What it means

CoNLLUOutputter.print writes CoNLL-U rows including a dependency column selected by the configured dependenciesType. Only an enum with an annotation plus BASIC (and enhanced variants above) are handled; any other value hits the default branch and throws IllegalArgumentException.

Solutions

  1. Set the dependencies type to a supported value (e.g. basic, enhanced, enhanced-plus-plus).
  2. Check the spelling/case of the configured dependenciesType string.
  3. If you need an unsupported dependency representation, post-process the CoNLL-U output or use a different outputter.

Example fix

// before
props.setProperty("output.dependenciesType", "enhancedDependencys");
// after
props.setProperty("output.dependenciesType", "enhanced");
Defensive patterns

Strategy: validation

Validate before calling

Set<String> allowed = new HashSet<>(Arrays.asList("basic", "enhanced", "enhanced-plus-plus"));
if (!allowed.contains(depsType.toLowerCase())) throw new IllegalArgumentException("Unsupported dependenciesType: " + depsType);

Try / catch

try { outputter.print(annotation, os); } catch (IllegalArgumentException e) { if (e.getMessage().contains("unknown dependencies type")) { log.error("Fix output.dependenciesType: " + e.getMessage()); } else { throw e; } }

Prevention

When it happens

Trigger: Configuring the conllu outputter (output.dependenciesType / "dependenciesType" option) with a value that maps to a DependenciesType enum constant lacking a supported annotation and is not BASIC, e.g. an unrecognized or unsupported name.

Common situations: Typo in the dependenciesType option value; using a DependenciesType constant from a different CoreNLP version that this outputter does not support; copy-pasting config from a pipeline using a different output format.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/pipeline/CoNLLUOutputter.java:129

  @Override
  public void print(Annotation doc, OutputStream target, Options options) throws IOException {
    PrintWriter writer = new PrintWriter(IOUtils.encodedOutputStreamWriter(target, options.encoding));

    List<CoreMap> sentences = doc.get(CoreAnnotations.SentencesAnnotation.class);
    for (CoreMap sentence : sentences) {
      SemanticGraph sg = sentence.get(SemanticGraphCoreAnnotations.BasicDependenciesAnnotation.class);
      if (sg != null) {
        switch (dependenciesType) {
        case ENHANCED:
        case ENHANCEDPLUSPLUS:
          writer.print(conllUWriter.printSemanticGraph(sg, sentence.get(dependenciesType.annotation())));
          break;
        case BASIC:
          writer.print(conllUWriter.printSemanticGraph(sg));
          break;
        default:
          throw new IllegalArgumentException("CoNLLUOutputter: unknown dependencies type " + dependenciesType);
        }
      } else {
        writer.print(conllUWriter.printPOSAnnotations(sentence, options.printFakeDeps));
      }
    }
    writer.flush();
  }


  public static void conllUPrint(Annotation annotation, OutputStream os) throws IOException {
    new CoNLLUOutputter().print(annotation, os);
  }

  public static void conllUPrint(Annotation annotation, OutputStream os, StanfordCoreNLP pipeline) throws IOException {
    new CoNLLUOutputter().print(annotation, os, pipeline);
  }

  public static void conllUPrint(Annotation annotation, OutputStream os, Options options) throws IOException {

View on GitHub (pinned to 1b7edd19c4)