{"record":{"id":"6fccc5ba4a830fdc","repo":"stanfordnlp/CoreNLP","slug":"failed-to-process-timex","errorCode":null,"errorMessage":"Failed to process timex ","messagePattern":"Failed to process timex ","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/edu/stanford/nlp/time/TimeExpressionExtractorImpl.java","lineNumber":161,"sourceCode":"          if (options.includeRange) {\n            SUTime.Temporal rangeTemporal = temporal.getRange();\n            if (rangeTemporal != null) {\n              timexAttributes.put(\"range\", rangeTemporal.toString());\n            }\n          }\n        } catch (Exception e) {\n          if (options.verbose) {\n            logger.warn(\"Failed to get attributes from \" + text + \", timeIndex \" + timeIndex);\n            logger.warn(e);\n          }\n          continue;\n        }\n        Timex timex;\n        try {\n          timex = Timex.fromMap(text, timexAttributes);\n        } catch (Exception e) {\n          if (options.verbose) {\n            logger.warn(\"Failed to process timex \" + text + \" with attributes \" + timexAttributes);\n            logger.warn(e);\n          }\n          continue;\n        }\n        assert timex != null;  // Timex.fromMap never returns null and if it exceptions, we've already done a continue\n        cm.set(TimeAnnotations.TimexAnnotation.class, timex);\n        coreMaps.add(cm);\n      }\n    }\n    return coreMaps;\n  }\n\n  public List<TimeExpression> extractTimeExpressions(CoreMap annotation, String refDateStr, SUTime.TimeIndex timeIndex) {\n    SUTime.Time refDate = null;\n    if (refDateStr != 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","sourceCodeStart":143,"sourceCodeEnd":179,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/time/TimeExpressionExtractorImpl.java#L143-L179","documentation":"A logged warning in toCoreMaps: after attributes were collected, Timex.fromMap(text, timexAttributes) itself threw. The code logs 'Failed to process timex <text> with attributes <map>' (when verbose), skips the expression via continue, and no TimexAnnotation is set. Unlike the previous catch, the attributes map exists but converting it into a Timex object failed.","triggerScenarios":"extractTimeExpressionCoreMaps -> toCoreMaps with a timexAttributes map that Timex.fromMap cannot consume — e.g. missing/odd 'value' or 'tid' entries produced by a broken rule, or text that defeats Timex's string handling.","commonSituations":"Custom SUTime rule sets emitting attributes that violate Timex expectations; annotating noisy OCR/HTML-derived text; version drift where Timex attribute keys changed but custom rules still emit old keys.","solutions":["Enable sutime.verbose and inspect the logged attributes map to see which key/value upset Timex.fromMap","Correct the SUTime rule so it emits standard attributes (value, altVal, tid, type, begin/end)","Upgrade Stanford CoreNLP; Timex.fromMap and SUTime attribute handling have been hardened over releases","As a workaround, post-filter: detect CoreMaps lacking TimexAnnotation and handle them downstream"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// verify every produced CoreMap carries a Timex annotation before consuming it\nfor (CoreMap cm : coreMaps) {\n  if (cm.get(TimeAnnotations.TimexAnnotation.class) == null) {\n    log.warn(\"Missing Timex for: \" + cm); // handle/fallback\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use stock SUTime rule files unless you control their attribute output","Validate custom rule output attributes against Timex's expected keys (value, tid, type, begin, end)","Handle downstream absence of TimexAnnotation defensively"],"tags":["java","nlp","sutime","timex"],"backgroundTag":"unexpected-api-response-shape","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}