pentaho/pentaho-kettle · error · KettleException

Rest.Exception.HeaderFieldEmpty

Rest.Exception.HeaderFieldEmpty

Error message

Rest.Exception.HeaderFieldEmpty

What it means

Thrown in calcHeaders (from processRow) with message 'Header field is missing!': one of the configured HTTP header entries has an empty 'field' — i.e., the row-field whose value should become the header value is blank after environment substitution.

Solutions

  1. Open the REST step's header table and fill in the missing 'Field' column for the flagged row (field in the stream whose value is sent as the header value).
  2. Delete header rows that are no longer needed.
  3. Check that variables used in the Field column are defined so they do not resolve to empty.

Example fix

// before (header matrix row)
name="Authorization"; field=""            // throws HeaderFieldEmpty
// after
name="Authorization"; field="auth_token"
Defensive patterns

Strategy: validation

Validate before calling

// Check every header entry has a field before running
for (int i = 0; i < restMeta.getHeaderField().length; i++) {
  String f = restMeta.getHeaderField()[i];
  if (f == null || f.trim().isEmpty()) {
    throw new IllegalStateException("Header '" + restMeta.getHeaderName()[i] + "' has no field set");
  }
}

Try / catch

try { processRow(); } catch (KettleException e) {
  if (e.getMessage().contains("Header field is missing")) { /* fill in the header table */ }
  throw e;
}

Prevention

When it happens

Trigger: meta.getHeaderField()[i] is null/empty (Utils.isEmpty) for some header index i while headers are configured ('Use headers' path in calcHeaders during processRow).

Common situations: Header table in the dialog has a row where the 'Field' column was left empty (only the header name filled); a variable used as the field name resolves to empty; copy-pasted header rows where the value column was cleared.

Understand the failure class

Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.

Related errors


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

Appendix: source

Thrown at plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/Rest.java:529

  }

  /**
   * Calculate headers
   *
   * @throws KettleException
   */
  private void calcHeaders() throws KettleException {
    int nrArgs = meta.getHeaderName() == null ? 0 : meta.getHeaderName().length;
    if ( nrArgs > 0 ) {
      data.nrheader = nrArgs;
      data.indexOfHeaderFields = new int[ nrArgs ];
      data.headerNames = new String[ nrArgs ];
      for ( int i = 0; i < nrArgs; i++ ) {
        // split into body / header
        data.headerNames[ i ] = environmentSubstitute( meta.getHeaderName()[ i ] );
        String field = environmentSubstitute( meta.getHeaderField()[ i ] );
        if ( Utils.isEmpty( field ) ) {
          throw new KettleException( BaseMessages.getString( PKG, "Rest.Exception.HeaderFieldEmpty" ) );
        }
        data.indexOfHeaderFields[ i ] = data.inputRowMeta.indexOfValue( field );
        if ( data.indexOfHeaderFields[ i ] < 0 ) {
          throw new KettleException( BaseMessages.getString( PKG, "Rest.Exception.ErrorFindingField", field ) );
        }
      }
      data.useHeaders = true;
    }
  }

  /**
   * Calculate the parameters
   *
   * @throws KettleException
   */
  private void calcParameters() throws KettleException {
    // Parameters
    int nrParams = meta.getParameterField() == null ? 0 : meta.getParameterField().length;

View on GitHub (pinned to f3058517a1)