stanfordnlp/CoreNLP · error · IllegalArgumentException

Unknown timeAnnotator

Error message

Unknown timeAnnotator: ${timeAnnotator}

What it means

SUTimeMain builds an annotation pipeline from a named time annotator (heideltime, sutime, etc.). Passing any other name hits the default branch and throws IllegalArgumentException. It is purely a configuration/naming mistake: the chosen timeAnnotator string is not one of the implemented options.

Solutions

  1. Set timeAnnotator to exactly 'sutime' (or 'heideltime') as supported by your CoreNLP version
  2. Check spelling/case against the switch statement in SUTimeMain.createPipeline
  3. Confirm the annotator's dependency is present (HeidelTime needs its JAR) — though a missing dependency is a separate failure
  4. Use a CoreNLP version that includes the annotator you intended

Example fix

// before
Properties props = new Properties();
props.setProperty("timeAnnotator", "SUTime");
// after
props.setProperty("timeAnnotator", "sutime");
Defensive patterns

Strategy: validation

Validate before calling

Set<String> valid = Set.of("sutime", "heideltime");
if (!valid.contains(timeAnnotator)) { throw new IllegalArgumentException("timeAnnotator must be one of " + valid); }

Try / catch

try { pipeline = createPipeline(props); } catch (IllegalArgumentException e) { /* log accepted values and fix config */ }

Prevention

When it happens

Trigger: Running SUTimeMain with the timeAnnotator option set to a misspelled or unsupported value (e.g. 'SUTime', 'heidel', 'gutime') instead of exactly 'sutime' or 'heideltime'.

Common situations: Typo in command-line/properties config, copying examples from other tools (GUTime, HeidelTime standalone), or older/newer versions where the available annotator set differs.

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/7518e6ec75e12559. Report an issue: GitHub.

Appendix: source

Thrown at src/edu/stanford/nlp/time/SUTimeMain.java:903

    }
    pipeline.addAnnotator(new POSTaggerAnnotator(false));
//    pipeline.addAnnotator(new NumberAnnotator(false));
//    pipeline.addAnnotator(new QuantifiableEntityNormalizingAnnotator(false, false));
    String timeAnnotator = props.getProperty("timeAnnotator", "sutime");
    switch (timeAnnotator) {
      case "gutime":
        useGUTime = true;
        pipeline.addAnnotator(new GUTimeAnnotator("gutime", props));
        break;
      case "heideltime":
        requiredDocDateFormat = "yyyy-MM-dd";
        pipeline.addAnnotator(new HeidelTimeAnnotator("heideltime", props));
        break;
      case "sutime":
        pipeline.addAnnotator(new TimeAnnotator("sutime", props));
        break;
      default:
        throw new IllegalArgumentException("Unknown timeAnnotator: " + timeAnnotator);
    }
    return pipeline;
  }

  enum InputType { TEXTFILE, TEXT, TIMEBANK_CSV, TEMPEVAL2, TEMPEVAL3 }

  private static void configLogger(String out) throws IOException {
    File outDir = new File(out);
    if (!outDir.exists()) {
      outDir.mkdirs();
    }
    StringBuilder sb = new StringBuilder();
    sb.append("handlers=java.util.logging.ConsoleHandler, java.util.logging.FileHandler\n");
    sb.append(".level=SEVERE\n");
    sb.append("edu.stanford.nlp.level=INFO\n");
    sb.append("java.util.logging.ConsoleHandler.level=SEVERE\n");
    sb.append("java.util.logging.FileHandler.formatter=java.util.logging.SimpleFormatter\n");
    sb.append("java.util.logging.FileHandler.level=INFO\n");

View on GitHub (pinned to 1b7edd19c4)