pentaho/pentaho-kettle · error · KettleException

Unable to convert value [ + textContent + ] for field [ +…

Error message

Unable to convert value [ + textContent + ] for field [ + field.getWsName() + ], type [ + field.getXsdType() + ]

What it means

KettleException thrown by WebService.getNodeValue when getValue(textContent, field) cannot convert the DOM node's text content into the Kettle value type declared for the field (field.getXsdType()). The message echoes the offending text, field name, and XSD type.

Solutions

  1. Check the value and type in the message and correct the field's XSD type in the step's output field definitions to match the response.
  2. Handle empty/nil values: verify the server should be sending them and set the field type to String if conversion isn't possible.
  3. If the service sends locale-formatted numbers or non-ISO dates, request XML-schema-safe formatting from the service or convert via a subsequent step.
  4. Re-fetch WSDL/field metadata after a service contract change.

Example fix

// before
// field "quantity" configured as Integer, server sends "12.5"
// after
// set field "quantity" XSD type to Number (double) to accept 12.5
Defensive patterns

Strategy: validation

Validate before calling

// Validate each output field's declared XSD type against a sample response value before the run:
Object sample = sampleValueFor(field); // from a test call
if (field.getXsdType().equalsIgnoreCase("Integer") && !sample.toString().matches("-?\\d+")) {
  throw new IllegalStateException("Type mismatch for field " + field.getWsName() + ": " + sample);
}

Try / catch

try {
  // run transformation
} catch (KettleException e) {
  if (e.getMessage() != null && e.getMessage().startsWith("Unable to convert value")) {
    // relax the field's XSD type to String or correct it per the message's value/type
  }
}

Prevention

When it happens

Trigger: DOM output processing: node.getTextContent() yields a string that fails conversion in getValue() — e.g. non-numeric text for an Integer/Number field, empty string for a Date, or locale-formatted numbers like '1,234.56'.

Common situations: Field XSD type configured in the step doesn't match what the service actually sends; server changed the value format (decimal separator, date format); optional element present but empty; null-like values ('nil', 'N/A') sent as text.

Understand the failure class

Background: Type mismatch errors: IllegalArgumentException, TypeError and type guards across 150 open-source libraries — this error's family across 150 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/steps/webservices/WebService.java:1031

      // Unknown field : don't look any further, it's not a field we want to use.
      //
      return false;
    }

    // if it's a text node or if we recognize the field type, we just grab the value
    //
    if ( node.getNodeType() == Node.TEXT_NODE || !field.isComplex() ) {
      Object rowValue = null;

      // See if this is a node we expect as a return value...
      //
      String textContent = node.getTextContent();
      try {
        rowValue = getValue( textContent, field );
        outputRowData[ outputIndex ] = rowValue;
        return true;
      } catch ( Exception e ) {
        throw new KettleException( "Unable to convert value ["
          + textContent + "] for field [" + field.getWsName() + "], type [" + field.getXsdType() + "]", e );
      }
    } else if ( node.getNodeType() == Node.ELEMENT_NODE ) {
      // Perhaps we're dealing with complex data types.
      // Perhaps we can just ship the XML snippet over to the next steps.
      //
      try {
        StringWriter childNodeXML = new StringWriter();
        transformer.transform( new DOMSource( node ), new StreamResult( childNodeXML ) );
        outputRowData[ outputIndex ] = childNodeXML.toString();
        return true;
      } catch ( Exception e ) {
        throw new KettleException( "Unable to transform DOM node with name [" + node.getNodeName() + "] to XML", e );
      }
    }

    // Nothing found, return false
    //

View on GitHub (pinned to f3058517a1)