jenkinsci/jenkins · critical · NotTalkingToJenkinsException
There's no Jenkins running at {}
Error message
There's no Jenkins running at {} What it means
CLI.NotTalkingToJenkinsException is thrown by CLI.verifyJenkinsConnection when an HTTP response carries neither the 'X-Hudson' nor the 'X-Jenkins' header. Those headers are set by every Jenkins controller, so their absence means the URL does not point at a live Jenkins instance. main() catches it specially and exits with status 3.
Source
Thrown at cli/src/main/java/hudson/cli/CLI.java:88
/**
* CLI entry point to Jenkins.
*/
@SuppressFBWarnings(value = "CRLF_INJECTION_LOGS", justification = "We don't care about this behavior")
public class CLI {
private CLI() {}
/**
* Make sure the connection is open against Jenkins server.
*
* @param c The open connection.
* @throws IOException in case of communication problem.
* @throws NotTalkingToJenkinsException when connection is not made to Jenkins service.
*/
/*package*/ static void verifyJenkinsConnection(URLConnection c) throws IOException {
if (c.getHeaderField("X-Hudson") == null && c.getHeaderField("X-Jenkins") == null)
throw new NotTalkingToJenkinsException(c);
}
/*package*/ static final class NotTalkingToJenkinsException extends IOException {
NotTalkingToJenkinsException(String s) {
super(s);
}
NotTalkingToJenkinsException(URLConnection c) {
super("There's no Jenkins running at " + c.getURL().toString());
}
}
public static void main(final String[] _args) throws Exception {
try {
System.exit(_main(_args));
} catch (NotTalkingToJenkinsException ex) {
System.err.println(ex.getMessage());
System.exit(3);View on GitHub (pinned to 2e228ff40b)
Solutions
- Verify the URL opens in a browser and shows the Jenkins UI; confirm the -s value matches it exactly including scheme and context path.
- Check that any reverse proxy in front of Jenkins passes through the X-Jenkins / X-Hudson response headers (avoid proxy_buffering or header-stripping directives).
- If Jenkins is still booting, wait for it to be fully 'READY' (check the actuator/health endpoint) before running the CLI.
Example fix
# before java -jar jenkins-cli.jar -s http://example.com help # after java -jar jenkins-cli.jar -s http://example.com/jenkins/ help
Defensive patterns
Strategy: try-catch
Validate before calling
// Reachability pre-check: confirm the X-Jenkins header is present
URL url = new URL(baseUrl);
HttpURLConnection c = (HttpURLConnection) url.openConnection();
c.setRequestMethod("GET");
c.connect();
boolean isJenkins = c.getHeaderField("X-Jenkins") != null;
if (!isJenkins) {
throw new IllegalStateException(baseUrl + " is not a Jenkins controller");
} Try / catch
try {
CLI._main(args);
} catch (CLI.NotTalkingToJenkinsException ex) {
// surface a clear message: URL is not a Jenkins instance
System.err.println("Jenkins not reachable at " + jenkinsUrl + ": " + ex.getMessage());
System.exit(3);
} Prevention
- Always derive the -s URL by copying it from the running Jenkins UI.
- Confirm the reverse proxy forwards X-Jenkins/X-Hudson response headers.
- Fetch the CLI jar from the target controller's /jnlpJars/ to keep versions aligned.
When it happens
Trigger: Running any 'jenkins-cli' command with a -s URL that resolves to a non-Jenkins HTTP server, a reverse proxy that strips response headers, a server that is down (returning an error page from a load balancer), or a plain 404/HTML page.
Common situations: Wrong -s URL (typo, missing port, http vs https); pointing the CLI at a reverse proxy/ingress that drops X-Jenkins; pointing at an artifact repository or static site instead of the controller; Jenkins still starting up and not yet serving requests.
Related errors
- There's no Jenkins running at {}, or is not serving the HTTP
- expected to see initial zero byte; perhaps you are connectin
- corrupt stream: negative frame length
- corrupt stream: negative operation code
- unknown operation #{}
AI-assisted analysis of jenkinsci/jenkins@2e228ff40b (2026-08-14).
Data as JSON: /api/errors/88c80b72157c9c2c.
Report an issue: GitHub.