stanfordnlp/CoreNLP · warning

DocDate mapping file failed to match against

Error message

DocDate mapping file failed to match against ${docID}

What it means

DocDateAnnotator resolves a document's date (used by SUTime for temporal grounding) either from a mapping file (docID -> date), a fixed date, or a regex over the doc ID. When useMappingFile is on and the docID has no entry in the mapping, the annotator logs this warning and returns an empty doc date, degrading downstream relative-date resolution.

Solutions

  1. Ensure the document IDs match the mapping-file keys exactly (check extensions, leading paths, case sensitivity).
  2. Add the missing docID entries to the mapping file, or regenerate it for the current corpus.
  3. Configure the sutime/bindir/docid pipeline so the DocIDAnnotator runs before DocDateAnnotator and sets the document ID.
  4. If an exact per-document date is unavailable, switch to the fixed-date (docdate.fixedDate) or regex-based mode as a fallback.

Example fix

// before: docID 'doc-001.txt' but mapping key is 'doc-001'
props.setProperty("docdate.mapping", "docdates.txt");

// after: normalize the ID before annotation, or add the exact key
props.setProperty("docdate.mapping", "docdates.txt");
// docdates.txt now contains: doc-001.txt	2013-05-14
Defensive patterns

Strategy: fallback

Validate before calling

// Confirm every docID has a mapping entry before annotation
for (String docId : docIds) {
  if (!docIdToDocDate.containsKey(docId)) {
    log.warn("No docdate mapping for " + docId + "; will fall back to empty date");
  }
}

Prevention

When it happens

Trigger: annotate() is run on an Annotation whose doc ID (from DocIDAnnotator or the 'docid' key) is absent from the configured docdates mapping file, or the annotation has no doc ID at all (docID becomes empty string and matches nothing).

Common situations: Mapping file not regenerated after new documents were added; doc IDs formatted differently than the mapping keys (extensions, paths, case); the docid annotator not configured so the ID is missing entirely.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at src/edu/stanford/nlp/pipeline/DocDateAnnotator.java:103

      sb.append("regex=");
      sb.append(regex);
    } else {
      sb.append("no docDate finder");
    }
    sb.append(']');
    description = sb.toString();
  }

  @Override
  public void annotate(Annotation annotation) {
    String docID = annotation.get(CoreAnnotations.DocIDAnnotation.class);
    if (docID == null)
      docID = "";
    String foundDocDate;
    if (useMappingFile) {
      foundDocDate = docIDToDocDate.get(docID);
      if (foundDocDate == null) {
        log.warn("DocDate mapping file failed to match against " + docID);
        foundDocDate = "";
      }
    } else if (useFixedDate || usePresentDate) {
      foundDocDate = fixedDate;
    } else if (useRegex) {
      Matcher m = fileDocDatePattern.matcher(docID);
      if (m.matches()) {
        foundDocDate = m.group(1);
        if (foundDocDate.length() == 8 && DATE_NO_HYPHENS_PATTERN.matcher(foundDocDate).matches()) {
          foundDocDate = addHyphensToDate(foundDocDate);
        }
      } else {
        log.warn("DocDate regex failed to match against " + docID);
        foundDocDate = "";
      }
    } else {
      foundDocDate = "";
    }

View on GitHub (pinned to 1b7edd19c4)