{"record":{"id":"22a6c1933ee04818","repo":"pentaho/pentaho-kettle","slug":"rest-exception-headerfieldempty","errorCode":"Rest.Exception.HeaderFieldEmpty","errorMessage":"Rest.Exception.HeaderFieldEmpty","messagePattern":"Rest\\.Exception\\.HeaderFieldEmpty","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/Rest.java","lineNumber":529,"sourceCode":"  }\n\n  /**\n   * Calculate headers\n   *\n   * @throws KettleException\n   */\n  private void calcHeaders() throws KettleException {\n    int nrArgs = meta.getHeaderName() == null ? 0 : meta.getHeaderName().length;\n    if ( nrArgs > 0 ) {\n      data.nrheader = nrArgs;\n      data.indexOfHeaderFields = new int[ nrArgs ];\n      data.headerNames = new String[ nrArgs ];\n      for ( int i = 0; i < nrArgs; i++ ) {\n        // split into body / header\n        data.headerNames[ i ] = environmentSubstitute( meta.getHeaderName()[ i ] );\n        String field = environmentSubstitute( meta.getHeaderField()[ i ] );\n        if ( Utils.isEmpty( field ) ) {\n          throw new KettleException( BaseMessages.getString( PKG, \"Rest.Exception.HeaderFieldEmpty\" ) );\n        }\n        data.indexOfHeaderFields[ i ] = data.inputRowMeta.indexOfValue( field );\n        if ( data.indexOfHeaderFields[ i ] < 0 ) {\n          throw new KettleException( BaseMessages.getString( PKG, \"Rest.Exception.ErrorFindingField\", field ) );\n        }\n      }\n      data.useHeaders = true;\n    }\n  }\n\n  /**\n   * Calculate the parameters\n   *\n   * @throws KettleException\n   */\n  private void calcParameters() throws KettleException {\n    // Parameters\n    int nrParams = meta.getParameterField() == null ? 0 : meta.getParameterField().length;","sourceCodeStart":511,"sourceCodeEnd":547,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/rest/core/src/main/java/org/pentaho/di/trans/steps/rest/Rest.java#L511-L547","documentation":"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.","triggerScenarios":"meta.getHeaderField()[i] is null/empty (Utils.isEmpty) for some header index i while headers are configured ('Use headers' path in calcHeaders during processRow).","commonSituations":"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.","solutions":["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).","Delete header rows that are no longer needed.","Check that variables used in the Field column are defined so they do not resolve to empty."],"exampleFix":"// before (header matrix row)\nname=\"Authorization\"; field=\"\"            // throws HeaderFieldEmpty\n// after\nname=\"Authorization\"; field=\"auth_token\"","handlingStrategy":"validation","validationCode":"// Check every header entry has a field before running\nfor (int i = 0; i < restMeta.getHeaderField().length; i++) {\n  String f = restMeta.getHeaderField()[i];\n  if (f == null || f.trim().isEmpty()) {\n    throw new IllegalStateException(\"Header '\" + restMeta.getHeaderName()[i] + \"' has no field set\");\n  }\n}","typeGuard":null,"tryCatchPattern":"try { processRow(); } catch (KettleException e) {\n  if (e.getMessage().contains(\"Header field is missing\")) { /* fill in the header table */ }\n  throw e;\n}","preventionTips":["Never leave the Field column blank in the header table; delete unused rows instead.","Validate the transformation before scheduling.","Check that variables used in the Field column resolve at runtime."],"tags":["configuration","http-headers","kettle","missing-field"],"backgroundTag":"empty-required-field","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}