karatelabs/karate · warning
process died while waiting for HTTP
Error message
process died while waiting for HTTP {} What it means
`PortUtils.waitForHttp` polls an HTTP URL expecting a response, but the `stillAlive` supplier reported the watched process died during the wait. It logs this warning and returns false rather than waiting for an endpoint that can never come up.
Solutions
- Read the process output/logs to find the actual exit cause
- Verify the URL and port match what the process actually serves
- Ensure the process has sufficient memory and valid startup configuration
- Fix the underlying startup failure and retry the wait
Defensive patterns
Strategy: retry
Try / catch
if (!PortUtils.waitForHttp(url, 60, 500, proc::isAlive)) {
// process died before serving: log proc output and exit code
throw new RuntimeException("process exited before HTTP endpoint " + url + " was ready");
} Prevention
- Pass a stillAlive supplier tied to the actual server process
- Verify the health URL responds 200 via curl before automating
- Ensure the process has enough memory/config to survive startup
When it happens
Trigger: Waiting for a child process's HTTP health endpoint via `waitForHttp(url, attempts, intervalMs, process::isAlive)`; the process crashes or exits before serving any HTTP response.
Common situations: Server failing on startup (bad config, missing port); unhandled exception in the app's bootstrap; container OOM-killed during startup; wrong URL/port in the wait call pointing nowhere while the process dies for an unrelated reason.
Related errors
- process died while waiting for port
- HTTP not available after attempts
- timeout waiting for stream readers - this should not happen
- exec() needs at least one argument
- karate.driver can only be read within a scenario
AI-assisted analysis of karatelabs/karate@a22eb90246 (2026-09-12).
Data as JSON: /api/errors/d6d4c70afc011bdc.
Report an issue: GitHub.
Appendix: source
Thrown at karate-core/src/main/java/io/karatelabs/process/PortUtils.java:87
} catch (Exception e) {
logger.trace("port {}:{} not yet available (attempt {})", host, port, i + 1);
sleep(intervalMs);
}
}
logger.warn("port {}:{} not available after {} attempts", host, port, attempts);
return false;
}
/**
* Wait for an HTTP endpoint to return 200.
*/
public static boolean waitForHttp(String url, int attempts, int intervalMs, BooleanSupplier stillAlive) {
HttpClient client = HttpClient.newBuilder()
.connectTimeout(Duration.ofSeconds(5))
.build();
for (int i = 0; i < attempts; i++) {
if (stillAlive != null && !stillAlive.getAsBoolean()) {
logger.warn("process died while waiting for HTTP {}", url);
return false;
}
try {
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.timeout(Duration.ofSeconds(5))
.GET()
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 200 && response.statusCode() < 300) {
logger.debug("HTTP {} is available after {} attempts", url, i + 1);
return true;
}
logger.trace("HTTP {} returned {} (attempt {})", url, response.statusCode(), i + 1);
} catch (Exception e) {
logger.trace("HTTP {} not available (attempt {}): {}", url, i + 1, e.getMessage());
}
sleep(intervalMs);View on GitHub (pinned to a22eb90246)