OpenRefine/OpenRefine · error · CalendarParserException

No date found in

Error message

No date found in "<dateStr>"

What it means

CalendarParser throws this when, after consuming the whole date string, no date components at all were recognized: parser state has neither year, month, nor day set. The string contained no usable date tokens (only separators, times, or unrecognized text), so there is nothing to build a date from.

Solutions

  1. Check the value actually looks like a date (contains digits or a month name) before parsing.
  2. Strip or short-circuit placeholder markers and treat them as null instead of attempting to parse.
  3. Catch CalendarParserException and fall back to a secondary parser or manual handling for exotic formats.
  4. Fix the data source to emit explicit dates in a standard format like ISO 8601 (yyyy-MM-dd).

Example fix

// before
Date d = CalendarParser.parse("n/a"); // No date found in "n/a"
// after
if (input == null || !input.matches(".*\\d.*")) {
    return null; // not a date, skip
}
Date d = CalendarParser.parse(input);
Defensive patterns

Strategy: validation

Validate before calling

boolean looksLikeADate(String s) {
    if (s == null || s.trim().isEmpty()) return false;
    return s.matches(".*\\d.*"); // require at least one digit token
}

Type guard

boolean hasDateContent(String s) {
    return s != null && s.matches(".*\\d{1,4}.*");
}

Try / catch

try {
    Date d = CalendarParser.parse(input);
} catch (CalendarParserException e) {
    log.warn("No date components in: " + input);
    return null;
}

Prevention

When it happens

Trigger: Calling CalendarParser.parse / parseDate with a string containing no recognizable year, month, or day, e.g. "--", "///", "12:30", "n/a", or whitespace/punctuation-only input.

Common situations: Spreadsheet cells holding placeholder text ("unknown", "-"), time-only strings, punctuation-only values that passed a naive non-blank check, or dates in an unrecognized format.

Related errors


AI-assisted analysis of OpenRefine/OpenRefine@a946177e04 (2026-09-08). Data as JSON: /api/errors/ec42d482edd9d1c7. Report an issue: GitHub.

Appendix: source

Thrown at modules/core/src/main/java/com/google/refine/expr/util/CalendarParser.java:1583

            try {
                final int val = Integer.parseInt(token);
                parseNumericToken(dateStr, state, val);
            } catch (NumberFormatException e) {
                parseNonNumericToken(dateStr, state, token);
            }
        }

        // before checking for errors, check for missing year
        if (!state.isDateSet() && state.getYear() <= 31) {
            int tmp = state.getDate();
            state.setDate(state.getYear());
            state.setYear(tmp);
        }

        if (!state.isDateSet()) {
            if (!state.isMonthSet()) {
                if (!state.isYearSet()) {
                    throw new CalendarParserException("No date found in \""
                            + dateStr + "\"");
                } else {
                    throw new CalendarParserException("Day and month missing"
                            + " from \"" + dateStr + "\"");
                }
            } else {
                throw new CalendarParserException("Day missing from \""
                        + dateStr + "\"");
            }
        } else if (!state.isMonthSet()) {
            if (!state.isYearSet()) {
                throw new CalendarParserException("Year and month missing"
                        + " from \"" + dateStr + "\"");
            } else {
                throw new CalendarParserException("Month missing from \""
                        + dateStr + "\"");
            }
        } else if (!state.isYearSet()) {

View on GitHub (pinned to a946177e04)