{"record":{"id":"a6149af384da224c","repo":"pentaho/pentaho-kettle","slug":"invalid-part-count-for-fault","errorCode":null,"errorMessage":"Invalid part count for fault!!","messagePattern":"Invalid part count for fault!!","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/webservices/wsdl/WsdlOpFaultList.java","lineNumber":72,"sourceCode":"  protected boolean add( Fault fault ) throws KettleStepException {\n    return add( getFault( fault ) );\n  }\n\n  /**\n   * Create a WsdlOpFault from the Fault.\n   *\n   * @param fault\n   *          Fault to process.\n   * @return WsdlOpFault Result of processing.\n   */\n  @SuppressWarnings( \"unchecked\" )\n  private WsdlOpFault getFault( Fault fault ) throws KettleStepException {\n    Message m = fault.getMessage();\n\n    // a fault should only have one message part.\n    Map<?, Part> partMap = m.getParts();\n    if ( partMap.size() != 1 ) {\n      throw new IllegalArgumentException( \"Invalid part count for fault!!\" );\n    }\n    Part faultPart = partMap.values().iterator().next();\n    boolean complexType = false;\n\n    // type of fault is specified either in Part's type or element attribute.\n    QName type = faultPart.getTypeName();\n    if ( type == null ) {\n      type = faultPart.getElementName();\n      Element schemaElement = _wsdlTypes.findNamedElement( type );\n      type = _wsdlTypes.getTypeQName( schemaElement.getAttribute( \"type\" ) );\n      complexType = true;\n    }\n    return new WsdlOpFault( fault.getName(), type, complexType, _wsdlTypes );\n  }\n}\n","sourceCodeStart":54,"sourceCodeEnd":88,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/webservices/wsdl/WsdlOpFaultList.java#L54-L88","documentation":"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.","triggerScenarios":"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.","commonSituations":"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>.","solutions":["Edit the WSDL so each fault message contains exactly one <part> (e.g., wrap the fault details in a single complex-type element).","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.","Use a different WSDL/service version whose fault definitions conform to WS-I (single-part faults).","Check whether the WSDL is generated by a tool that supports multi-part faults, and regenerate with document/literal wrapped style."],"exampleFix":"<!-- before -->\n<message name=\"myFault\">\n  <part name=\"code\" type=\"xsd:string\"/>\n  <part name=\"reason\" type=\"xsd:string\"/>\n</message>\n<!-- after -->\n<message name=\"myFault\">\n  <part name=\"fault\" element=\"tns:MyFaultDetail\"/> <!-- single part, complex type with code+reason -->\n</message>","handlingStrategy":"validation","validationCode":"// Validate fault messages have exactly one part before mapping\nMessage faultMsg = fault.getMessage();\nif (faultMsg == null || faultMsg.getParts().size() != 1) {\n  throw new IllegalArgumentException(\"Fault '\" + fault.getName()\n    + \"' must reference a message with exactly one part (found \"\n    + (faultMsg == null ? 0 : faultMsg.getParts().size()) + \")\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep fault messages single-part per WS-I basic profile","Validate WSDLs with wsimport or a linter before use","Wrap multi-field fault data in one complex type"],"tags":["wsdl","soap","fault","schema"],"backgroundTag":"schema-validation-failed","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"}