{"record":{"id":"8c78fc0809aab585","repo":"stanfordnlp/CoreNLP","slug":"java-io-ioexception-8c78fc","errorCode":null,"errorMessage":"java.io.IOException","messagePattern":"java\\.io\\.IOException","errorType":"exception","errorClass":"RuntimeIOException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/time/HeidelTimeAnnotator.java","lineNumber":76,"sourceCode":"    this.heideltimePath = heideltimePath;\n    this.outputResults = outputResults;\n    this.language = language;\n  }\n\n  public HeidelTimeAnnotator(String name, Properties props) {\n    this(new File(props.getProperty(HEIDELTIME_PATH_PROPERTY,\n            System.getProperty(\"heideltime\",\n                    DEFAULT_PATH))),\n        props.getProperty(HEIDELTIME_LANGUAGE_PROPERTY, \"english\"),\n        Boolean.valueOf(props.getProperty(HEIDELTIME_OUTPUT_RESULTS, \"false\")));\n  }\n\n  @Override\n  public void annotate(Annotation annotation) {\n    try {\n      this.annotate((CoreMap)annotation);\n    } catch (IOException e) {\n      throw new RuntimeIOException(e);\n    }\n  }\n\n  public void annotate(CoreMap document) throws IOException {\n    //--Create Input File\n    //(create file)\n    File inputFile = File.createTempFile(\"heideltime\", \".input\");\n    //(write to file)\n    PrintWriter inputWriter = new PrintWriter(inputFile);\n    inputWriter.println(document.get(CoreAnnotations.TextAnnotation.class));\n    inputWriter.close();\n\n    //--Get Date\n    //(error checks)\n    if(!document.containsKey(CoreAnnotations.CalendarAnnotation.class) && !document.containsKey(CoreAnnotations.DocDateAnnotation.class)){\n      throw new IllegalArgumentException(\"CoreMap must have either a Calendar or DocDate annotation\"); //not strictly necessary, technically...\n    }\n    //(variables)","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/time/HeidelTimeAnnotator.java#L58-L94","documentation":"HeidelTimeAnnotator.annotate() wraps the CoreMap-based annotate(), which shells out to the external HeidelTime binary via temporary files, in a catch of IOException rethrown as RuntimeIOException. It means the external HeidelTime process/file round-trip failed (binary missing, bad path, process error, or I/O failure).","triggerScenarios":"Calling Annotator pipeline with HeidelTimeAnnotator when the configured heideltime path doesn't exist, the script isn't executable, or the external command writes to a missing/unwritable temp directory.","commonSituations":"HeidelTime not installed on the machine or path misconfigured in annotator properties; deploying to a container/image that lacks Java version or resources HeidelTime needs; read-only filesystem preventing temp file creation.","solutions":["Verify the heideltime.path (or equivalent property) points to an executable HeidelTime script and test running it manually.","Catch RuntimeIOException around the annotate call and surface the underlying IOException's message.","Ensure the temp/input directory is writable and the document text is non-empty and valid.","Install HeidelTime (including its tree tagger dependency) and confirm Java compatibility."],"exampleFix":"// before\npipeline.annotate(annotation); // RuntimeIOException bubbles up\n// after\ntry {\n  pipeline.annotate(annotation);\n} catch (RuntimeIOException e) {\n  logger.severe(\"HeidelTime failed: \" + e.getCause());\n}","handlingStrategy":"try-catch","validationCode":"// Verify HeidelTime is runnable before building the pipeline\nProcess p = new ProcessBuilder(heideltimePath, \"--help\").start();\nif (p.waitFor(5, TimeUnit.SECONDS) && p.exitValue() != 0) {\n  throw new IllegalStateException(\"HeidelTime not runnable at \" + heideltimePath);\n}","typeGuard":"boolean isHeidelTimeAvailable(String path) {\n  return path != null && new File(path).canExecute();\n}","tryCatchPattern":"try {\n  heidelTimeAnnotator.annotate(annotation);\n} catch (RuntimeIOException e) {\n  IOException cause = (IOException) e.getCause();\n  logger.log(Level.SEVERE, \"HeidelTime I/O failure: \" + cause.getMessage(), cause);\n}","preventionTips":["Check the heideltime path and executability at application startup, not first annotate().","Pin HeidelTime and TreeTagger versions in your deployment image.","Ensure temp directories are writable in containers."],"tags":["java","ioexception","external-process","heideltime"],"backgroundTag":"file-read-failed","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"}