{"record":{"id":"453b7493c4906155","repo":"stanfordnlp/CoreNLP","slug":"warning-no-document-date-specified","errorCode":null,"errorMessage":"WARNING: No document date specified","messagePattern":"WARNING: No document date specified","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/edu/stanford/nlp/time/TimeExpressionExtractorImpl.java","lineNumber":82,"sourceCode":"    SUTime.TimeIndex timeIndex; // initialized immediately below\n    String docDate = null;\n    if (docAnnotation != null) {\n      timeIndex = docAnnotation.get(TimeExpression.TimeIndexAnnotation.class);\n      if (timeIndex == null) {\n        docAnnotation.set(TimeExpression.TimeIndexAnnotation.class, timeIndex = new SUTime.TimeIndex());\n      }\n      // default look for the sentence's forum post date\n      // if it doesn't have one, back off to the document date\n      if (annotation.get(CoreAnnotations.SectionDateAnnotation.class) != null) {\n        docDate = annotation.get(CoreAnnotations.SectionDateAnnotation.class);\n      } else {\n        docDate = docAnnotation.get(CoreAnnotations.DocDateAnnotation.class);\n      }\n      if (docDate == null) {\n        Calendar cal = docAnnotation.get(CoreAnnotations.CalendarAnnotation.class);\n        if (cal == null) {\n          if (options.verbose) {\n            logger.warn(\"WARNING: No document date specified\");\n          }\n        } else {\n          SimpleDateFormat dateFormat = new SimpleDateFormat(\"yyyy-MM-dd:hh:mm:ss\");\n          docDate = dateFormat.format(cal.getTime());\n        }\n      }\n    } else {\n      timeIndex = new SUTime.TimeIndex();\n    }\n    if (StringUtils.isNullOrEmpty(docDate)) {\n      docDate = null;\n    }\n    if (timeIndex.docDate == null && docDate != null) {\n      try {\n        // TODO: have more robust parsing of document date?  docDate may not have century....\n        // TODO: if docDate didn't change, we can cache the parsing of the docDate and not repeat it for every sentence\n        timeIndex.docDate = SUTime.parseDateTime(docDate,true);\n      } catch (Exception e) {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/time/TimeExpressionExtractorImpl.java#L64-L100","documentation":"TimeExpressionExtractorImpl.extractTimeExpressionCoreMaps needs a reference document date to ground extracted time expressions. When the DocDateAnnotation and CalendarAnnotation are both absent and options.verbose is on, it logs 'WARNING: No document date specified' and proceeds without an anchor, degrading resolution of relative time expressions.","triggerScenarios":"Invoking TimeAnnotator/TimeExpressionExtractorImpl on a document where neither DocDateAnnotation nor CalendarAnnotation is set, with the extractor's verbose option enabled.","commonSituations":"Verbose SUTime options in pipeline properties surfacing the warning that TimeAnnotator would otherwise show only when not quiet; batch processing documents lacking metadata; misconfigured pipelines skipping the docdate property.","solutions":["Set CoreAnnotations.DocDateAnnotation (e.g. via the docdate property or annotation.set) before time extraction.","Fall back to setting CalendarAnnotation with the document's date.","If no date is truly available, accept the warning or suppress it by turning off options.verbose.","Infer a default document date from file mtime or content heuristics and inject it as DocDateAnnotation."],"exampleFix":"// before\nMap<String,String> props = new HashMap<>();\nprops.put(\"sutime.verbose\", \"true\"); // warning shown, no docDate\n// after\nannotation.set(CoreAnnotations.DocDateAnnotation.class, \"2024-06-01\");","handlingStrategy":"validation","validationCode":"if (docAnnotation.get(CoreAnnotations.DocDateAnnotation.class) == null && docAnnotation.get(CoreAnnotations.CalendarAnnotation.class) == null) {\n  docAnnotation.set(CoreAnnotations.DocDateAnnotation.class, LocalDate.now().toString()); // or fail fast\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Inject a document date at pipeline construction time for every document","Treat missing docDate as a data-quality issue worth failing fast on in batch jobs","Keep SUTime verbose on in CI to catch documents missing dates","Document the docdate requirement wherever TimeAnnotator is configured"],"tags":["nlp","sutime","time","missing-metadata"],"backgroundTag":"missing-required-config-field","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}