{"record":{"id":"760d14a9d653c3f2","repo":"stanfordnlp/CoreNLP","slug":"server-is-not-ready-and-can-not-start-it","errorCode":null,"errorMessage":"Server is not ready and can not start it!","messagePattern":"Server is not ready and can not start it!","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"critical","filePath":"src/edu/stanford/nlp/pipeline/WebServiceAnnotator.java","lineNumber":290,"sourceCode":"\n    // 3. Wait for the target server to become ready\n    synchronized (this) {\n      if (this.server.isPresent()) {\n        while (!this.server.get().ready) {\n          if (System.currentTimeMillis() > startTime + CONNECT_TIMEOUT) {\n            throw new TimeoutException(\"Never got readiness from annotator: \" + this);\n          }\n          if (!ready(true)) {\n            try {\n              Thread.sleep(1000);\n            } catch (InterruptedException ignored) {\n            }\n          } else {\n            this.server.get().ready = true;\n          }\n        }\n      } else if (!ready(false)) { // The server is not ready\n        throw new IOException(\"Server is not ready and can not start it!\");\n      }\n    }\n    log.info(\"Got readiness from server for \" + this);\n    serverWasActive = true;\n\n    // 4. Server is ensured! We can continue\n  }\n\n  /** {@inheritDoc} */\n  public void unmount() {\n    log.info(\"Unmounting server: \" + this);\n    synchronized (this) {\n      if (this.server.isPresent()) {\n        this.server.get().kill();\n        this.server = Optional.empty();\n      }\n      // run optional stop script\n      try {","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/WebServiceAnnotator.java#L272-L308","documentation":"In ensureServer, when no locally managed server exists and a readiness probe (ready(false)) fails, the annotator cannot start or connect to anything, so it throws this IOException. This happens when no start command is configured and the remote target is not ready.","triggerScenarios":"Using a WebServiceAnnotator without a start command (expecting an already-running external service) while the remote endpoint is down, wrong port, or still initializing — ready(false) returns false and there is nothing to launch.","commonSituations":"Forgetting to start the external annotator service before building the pipeline, pointing at the wrong host/port, or the service crashed between checks.","solutions":["Start the external annotator service before constructing the pipeline (or configure webservice.command so the annotator can launch it)","Verify the configured URL/port points at the live service (curl it first)","Check whether the service died; restart it and retry pipeline construction","Add retry/backoff around pipeline construction if the service startup is asynchronous"],"exampleFix":"// before\nprops.setProperty(\"webservice.url\", \"http://localhost:8140\"); // service never started\n// after\n// start service first: server.sh --port 8140 &\nprops.setProperty(\"webservice.url\", \"http://localhost:8140\");","handlingStrategy":"validation","validationCode":"// Ensure target is ready before constructing the annotator\nif (props.getProperty(\"webservice.command\") == null) {\n  int code;\n  try {\n    code = ((java.net.HttpURLConnection) new java.net.URL(props.getProperty(\"webservice.url\")).openConnection()).getResponseCode();\n  } catch (java.io.IOException e) { code = -1; }\n  if (code < 200 || code >= 500)\n    throw new IllegalStateException(\"External annotator service not reachable at \" + props.getProperty(\"webservice.url\"));\n}","typeGuard":null,"tryCatchPattern":"try {\n  pipeline.annotate(doc);\n} catch (java.io.IOException e) {\n  if (e.getMessage().contains(\"Server is not ready\")) {\n    log.error(\"No start command configured and target not ready: start the service or set webservice.command\");\n  }\n  throw e;\n}","preventionTips":["Always start the external service before building the pipeline","Configure webservice.command if you want automatic local startup","Health-check the target URL during deployment readiness probes","Keep service and pipeline lifecycles coupled (start/stop together)"],"tags":["web-service","server-not-ready","configuration"],"backgroundTag":"connection-refused","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"}