pentaho/pentaho-kettle · error · KettleException

StatusCode:

Error message

StatusCode: 

What it means

Thrown by JobEntryHTTP's execute logic when the HTTP response status code is not 200 (HttpStatus.SC_OK). The status code is appended to the message. The library deliberately treats any non-OK status as a failure of the HTTP job entry, since the entry's contract is to fetch a resource successfully.

Solutions

  1. Read responseStatusCode in the message and address it: fix the URL for 404, add auth headers for 401/403, fix server-side issues for 5xx.
  2. Verify the resource exists and is reachable from the Pentaho server's network (proxy/firewall).
  3. Enable/verify redirect handling in the HTTP client configuration if the target moved.
  4. If the endpoint legitimately returns non-200, wrap the entry with error handling in the job flow instead of failing.

Example fix

// before: URL returns 404
String url = "http://host/old-path/file.xml";
// after: corrected URL
String url = "http://host/new-path/file.xml";
// and/or add auth header before executing
httpGet.setHeader("Authorization", "Bearer " + token);
Defensive patterns

Strategy: validation

Validate before calling

// pre-flight check before running the HTTP entry
HttpURLConnection c = (HttpURLConnection) new URL(url).openConnection();
c.setRequestMethod("HEAD");
c.setConnectTimeout(5000);
int code = c.getResponseCode();
if (code != 200) throw new IllegalStateException("Pre-flight failed with HTTP " + code + " for " + url);

Try / catch

try {
  result = jobEntry.execute(prevResult, nr);
} catch (KettleException e) {
  if (e.getMessage().startsWith("StatusCode: ")) {
    int code = Integer.parseInt(e.getMessage().substring("StatusCode: ".length()));
    logError("HTTP entry got status " + code);
    result.setResult(false);
  }
}

Prevention

When it happens

Trigger: Running the HTTP job entry (client.execute returning a response whose getStatusLine().getStatusCode() != 200) — e.g. 404 for a wrong URL, 401/403 for missing credentials, 500 from the server, 301/302 when redirects are disabled.

Common situations: Target URL mistyped or resource moved; authentication headers missing or expired; server-side error at the remote endpoint; proxy/firewall returning error pages; redirect responses when follow-redirects is off.

Related errors


AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13). Data as JSON: /api/errors/46479571aec40df9. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/entries/http/JobEntryHTTP.java:685

    HttpResponse response = null;
    if ( !Utils.isEmpty( proxyHostname ) ) {
      HttpHost target = new HttpHost( uri.getHost(), uri.getPort(), uri.getScheme() );
      // Create AuthCache instance
      AuthCache authCache = new BasicAuthCache();
      // Generate BASIC scheme object and add it to the local auth cache
      BasicScheme basicAuth = new BasicScheme();
      authCache.put( target, basicAuth );
      // Add AuthCache to the execution context
      HttpClientContext localContext = HttpClientContext.create();
      localContext.setAuthCache( authCache );
      response = client.execute( target, httpRequestBase, localContext );
    } else {
      response = client.execute( httpRequestBase );
    }
    responseStatusCode = response.getStatusLine().getStatusCode();

    if ( HttpStatus.SC_OK != responseStatusCode ) {
      throw new KettleException( "StatusCode: " + responseStatusCode );
    }

    if ( log.isDetailed() ) {
      logDetailed( BaseMessages.getString( PKG, "JobHTTP.Log.StartReadingReply" ) );
    }

    logBasic( BaseMessages.getString( PKG, "JobHTTP.Log.ReplayInfo",
      response.getEntity().getContentType(),
      response.getLastHeader( HttpHeaders.DATE ).getValue() ) );

    // Read the result from the server...
    return response.getEntity().getContent();
  }

  @Override
  public boolean evaluates() {
    return true;
  }

View on GitHub (pinned to f3058517a1)