stanfordnlp/CoreNLP · error · UnsupportedOperationException

no value specified for

Error message

no value specified for ${this}

What it means

Timex.getRange(documentTime) throws UnsupportedOperationException immediately when the Timex 'val' is null. Without a value string there is no date or duration to expand into a begin/end Calendar pair.

Solutions

  1. Ensure the TIMEX3 source annotation has a VAL attribute before extracting ranges
  2. Check timex.val() for null before calling getRange() and skip such Timexes
  3. If you built the Timex yourself, pass the value string in the constructor
  4. Re-run the temporal normalizer (SUTime) with proper document creation time so VAL gets filled

Example fix

// before
Pair<Calendar,Calendar> range = timex.getRange(documentTime);
// after
if (timex.val() == null) {
  throw new SkipTimexException("Timex has no VAL");
}
Pair<Calendar,Calendar> range = timex.getRange(documentTime);
Defensive patterns

Strategy: validation

Validate before calling

if (timex.val() == null) { skip(); } else { timex.getRange(documentTime); }

Type guard

boolean hasVal(Timex t) { return t != null && t.val() != null; }

Try / catch

try { range = timex.getRange(documentTime); } catch (UnsupportedOperationException e) { range = null; }

Prevention

When it happens

Trigger: Calling getRange() on a Timex constructed without a value, e.g. new Timex(type) without val, or a TIMEX3 annotation whose VAL attribute was absent in the source TimeML document.

Common situations: Processing TimeML where some TIMEX3 elements only carry a type (DATE/DURATION) and begin/end offsets but no normalized VAL attribute, then asking for the range.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/time/Timex.java:392

   */
  public Pair<Calendar, Calendar> getRange() {
    return this.getRange(null);
  }

  /**
   * Gets two Calendars, marking the beginning and ending of this Timex's range.
   *
   * @param documentTime
   *          The time the document containing this Timex was written. (Not
   *          necessary for resolving all Timex expressions. This may be
   *          {@code null}, but then relative time expressions cannot be
   *          resolved.)
   * @return The begin point and end point Calendars.
   */
  public Pair<Calendar, Calendar> getRange(Timex documentTime) {

    if (this.val == null) {
      throw new UnsupportedOperationException("no value specified for " + this);
    }

    // YYYYMMDD or YYYYMMDDT... where the time is concatenated directly with the
    // date
    else if (val.length() >= 8 && Pattern.matches("\\d\\d\\d\\d\\d\\d\\d\\d", this.val.substring(0, 8))) {
      int year = Integer.parseInt(this.val.substring(0, 4));
      int month = Integer.parseInt(this.val.substring(4, 6));
      int day = Integer.parseInt(this.val.substring(6, 8));
      return new Pair<>(makeCalendar(year, month, day), makeCalendar(year, month, day));
    }
    // YYYY-MM-DD or YYYY-MM-DDT...
    else if (val.length() >= 10 && Pattern.matches("\\d\\d\\d\\d-\\d\\d-\\d\\d", this.val.substring(0, 10))) {
      int year = Integer.parseInt(this.val.substring(0, 4));
      int month = Integer.parseInt(this.val.substring(5, 7));
      int day = Integer.parseInt(this.val.substring(8, 10));
      return new Pair<>(makeCalendar(year, month, day), makeCalendar(year, month, day));
    }

View on GitHub (pinned to 1b7edd19c4)