pentaho/pentaho-kettle · error · KettleException

SalesforceConnection.UnableToFindObjectType

Error message

SalesforceConnection.UnableToFindObjectType

What it means

SalesforceConnection throws this KettleException while building an upsert foreign-key element: it could not resolve the type of the value/object being looked up via the external ID field. The connection needs to know the Salesforce object type to construct the upsert element, and the supplied value did not correspond to any resolvable object type.

Solutions

  1. Verify the upsert step's lookup/external ID field is configured with a valid Salesforce object type
  2. Ensure the value passed to the connection is the expected object type (not a bare untyped value)
  3. Check the field mapping in the transformation so the value's type matches the target Salesforce object
  4. Enable detailed logging on the connection to see which value failed type resolution

Example fix

// before: passing an untyped value into the upsert element builder
MessageElement me = connection.createForeignKeyElement(type, lookupField, extIdName, someString);
// after: resolve/validate the object type first
String objectType = connection.getObjectTypeFor(value);
if (objectType == null) { throw new KettleException("Cannot resolve Salesforce object type for upsert value"); }
MessageElement me = connection.createForeignKeyElement(objectType, lookupField, extIdName, value);
Defensive patterns

Strategy: validation

Validate before calling

// before calling the upsert element builder
String objectType = connection.getObjectTypeFor(value);
if (objectType == null || objectType.isEmpty()) {
  throw new IllegalArgumentException("Cannot resolve Salesforce object type for value: " + value);
}

Type guard

// Java: narrow the value to a type that maps to a Salesforce object
boolean isResolvableObjectType(Object value) {
  return value != null && objectTypeRegistry.containsKey(value.getClass());
}

Try / catch

try {
  me = createForeignKeyElement(type, lookupField, extIdName, value);
} catch (KettleException e) {
  if (e.getMessage().contains("UnableToFindObjectType")) {
    logError("Object type could not be resolved for upsert value; check field mapping: " + value);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling the connection's upsert/foreign-key element construction path with a value whose object type cannot be determined — e.g. the lookup value is not a recognized Salesforce object instance/type and the code falls into the final else branch.

Common situations: Upsert transformations pointing at an external ID field where the incoming data type doesn't map to a Salesforce object type; passing a plain string/value where a typed object is expected; typos in the lookup field configuration.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


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

Appendix: source

Thrown at plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java:927

      int indexOfType = name.indexOf( ":" );
      if ( indexOfType > 0 ) {
        String type = name.substring( 0, indexOfType );
        String extIdName = null;
        String lookupField = null;

        String rest = name.substring( indexOfType + 1, name.length() );
        int indexOfExtId = rest.indexOf( "/" );
        if ( indexOfExtId > 0 ) {
          extIdName = rest.substring( 0, indexOfExtId );
          lookupField = rest.substring( indexOfExtId + 1, rest.length() );
        } else {
          extIdName = rest;
          lookupField = extIdName;
        }
        me = createForeignKeyElement( type, lookupField, extIdName, value );
      } else {
        throw new KettleException( BaseMessages.getString( PKG, "SalesforceConnection.UnableToFindObjectType" ) );
      }
    } else {
      me = fromTemplateElement( name, value, true );
    }

    return me;
  }

  private static XmlObject createForeignKeyElement( String type, String lookupField, String extIdName,
    Object extIdValue ) throws Exception {

    // Foreign key relationship to the object
    XmlObject me = fromTemplateElement( lookupField, null, false );
    me.addField( "type", type );
    me.addField( extIdName, extIdValue );

    return me;
  }

View on GitHub (pinned to f3058517a1)