pentaho/pentaho-kettle · error · IllegalArgumentException

Invalid part count for fault!!

Error message

Invalid part count for fault!!

What it means

WsdlOpFaultList.getFault(Fault) builds a fault descriptor from a WSDL <fault> element. SOAP faults must carry exactly one message part; if the fault's <message> declares zero or multiple parts, an IllegalArgumentException 'Invalid part count for fault!!' is thrown, since the mapper cannot represent a multi-part fault.

Solutions

  1. Edit the WSDL so each fault message contains exactly one <part> (e.g., wrap the fault details in a single complex-type element).
  2. If a rich fault structure is needed, define one element of a complex type that includes all fields, and reference it as the single part.
  3. Use a different WSDL/service version whose fault definitions conform to WS-I (single-part faults).
  4. Check whether the WSDL is generated by a tool that supports multi-part faults, and regenerate with document/literal wrapped style.

Example fix

<!-- before -->
<message name="myFault">
  <part name="code" type="xsd:string"/>
  <part name="reason" type="xsd:string"/>
</message>
<!-- after -->
<message name="myFault">
  <part name="fault" element="tns:MyFaultDetail"/> <!-- single part, complex type with code+reason -->
</message>
Defensive patterns

Strategy: validation

Validate before calling

// Validate fault messages have exactly one part before mapping
Message faultMsg = fault.getMessage();
if (faultMsg == null || faultMsg.getParts().size() != 1) {
  throw new IllegalArgumentException("Fault '" + fault.getName()
    + "' must reference a message with exactly one part (found "
    + (faultMsg == null ? 0 : faultMsg.getParts().size()) + ")");
}

Prevention

When it happens

Trigger: Parsing a WSDL whose <operation><fault name="..." message="..."> references a message element with more than one (or no) <part>, then calling add(...) which routes into getFault.

Common situations: Hand-written or code-generated WSDLs that model complex faults with several parts; WSDLs written for RPC/encoded style with multi-part fault messages; a WSDL that was edited and the fault message lost its single <part>.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/webservices/wsdl/WsdlOpFaultList.java:72

  protected boolean add( Fault fault ) throws KettleStepException {
    return add( getFault( fault ) );
  }

  /**
   * Create a WsdlOpFault from the Fault.
   *
   * @param fault
   *          Fault to process.
   * @return WsdlOpFault Result of processing.
   */
  @SuppressWarnings( "unchecked" )
  private WsdlOpFault getFault( Fault fault ) throws KettleStepException {
    Message m = fault.getMessage();

    // a fault should only have one message part.
    Map<?, Part> partMap = m.getParts();
    if ( partMap.size() != 1 ) {
      throw new IllegalArgumentException( "Invalid part count for fault!!" );
    }
    Part faultPart = partMap.values().iterator().next();
    boolean complexType = false;

    // type of fault is specified either in Part's type or element attribute.
    QName type = faultPart.getTypeName();
    if ( type == null ) {
      type = faultPart.getElementName();
      Element schemaElement = _wsdlTypes.findNamedElement( type );
      type = _wsdlTypes.getTypeQName( schemaElement.getAttribute( "type" ) );
      complexType = true;
    }
    return new WsdlOpFault( fault.getName(), type, complexType, _wsdlTypes );
  }
}

View on GitHub (pinned to f3058517a1)