{"record":{"id":"ec42d482edd9d1c7","repo":"OpenRefine/OpenRefine","slug":"no-date-found-in-datestr","errorCode":null,"errorMessage":"No date found in \"<dateStr>\"","messagePattern":"No date found in \"<dateStr>\"","errorType":"exception","errorClass":"CalendarParserException","httpStatus":null,"severity":"error","filePath":"modules/core/src/main/java/com/google/refine/expr/util/CalendarParser.java","lineNumber":1583,"sourceCode":"            try {\n                final int val = Integer.parseInt(token);\n                parseNumericToken(dateStr, state, val);\n            } catch (NumberFormatException e) {\n                parseNonNumericToken(dateStr, state, token);\n            }\n        }\n\n        // before checking for errors, check for missing year\n        if (!state.isDateSet() && state.getYear() <= 31) {\n            int tmp = state.getDate();\n            state.setDate(state.getYear());\n            state.setYear(tmp);\n        }\n\n        if (!state.isDateSet()) {\n            if (!state.isMonthSet()) {\n                if (!state.isYearSet()) {\n                    throw new CalendarParserException(\"No date found in \\\"\"\n                            + dateStr + \"\\\"\");\n                } else {\n                    throw new CalendarParserException(\"Day and month missing\"\n                            + \" from \\\"\" + dateStr + \"\\\"\");\n                }\n            } else {\n                throw new CalendarParserException(\"Day missing from \\\"\"\n                        + dateStr + \"\\\"\");\n            }\n        } else if (!state.isMonthSet()) {\n            if (!state.isYearSet()) {\n                throw new CalendarParserException(\"Year and month missing\"\n                        + \" from \\\"\" + dateStr + \"\\\"\");\n            } else {\n                throw new CalendarParserException(\"Month missing from \\\"\"\n                        + dateStr + \"\\\"\");\n            }\n        } else if (!state.isYearSet()) {","sourceCodeStart":1565,"sourceCodeEnd":1601,"githubUrl":"https://github.com/OpenRefine/OpenRefine/blob/a946177e049f3b0644261661db36cbb0c81ccf8a/modules/core/src/main/java/com/google/refine/expr/util/CalendarParser.java#L1565-L1601","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Check the value actually looks like a date (contains digits or a month name) before parsing.","Strip or short-circuit placeholder markers and treat them as null instead of attempting to parse.","Catch CalendarParserException and fall back to a secondary parser or manual handling for exotic formats.","Fix the data source to emit explicit dates in a standard format like ISO 8601 (yyyy-MM-dd)."],"exampleFix":"// before\nDate d = CalendarParser.parse(\"n/a\"); // No date found in \"n/a\"\n// after\nif (input == null || !input.matches(\".*\\\\d.*\")) {\n    return null; // not a date, skip\n}\nDate d = CalendarParser.parse(input);","handlingStrategy":"validation","validationCode":"boolean looksLikeADate(String s) {\n    if (s == null || s.trim().isEmpty()) return false;\n    return s.matches(\".*\\\\d.*\"); // require at least one digit token\n}","typeGuard":"boolean hasDateContent(String s) {\n    return s != null && s.matches(\".*\\\\d{1,4}.*\");\n}","tryCatchPattern":"try {\n    Date d = CalendarParser.parse(input);\n} catch (CalendarParserException e) {\n    log.warn(\"No date components in: \" + input);\n    return null;\n}","preventionTips":["Filter placeholder text (\"n/a\", \"-\", \"unknown\") before parsing.","Require at least one digit token before attempting a date parse.","Treat punctuation-only strings as empty during data cleaning.","Prefer ISO 8601 input formats."],"tags":["date-parsing","calendar","empty-input","openrefine"],"backgroundTag":"invalid-date-format","analyzedSha":"a946177e049f3b0644261661db36cbb0c81ccf8a","analyzedAt":"2026-09-08T10:21:27.735Z","contentChangedAt":"2026-09-08T10:21:27.735Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}