pentaho/pentaho-kettle · error · KettleXMLException

Invalid shared object type

Error message

Invalid shared object type ${type}

What it means

XmlFileSharedObjectsIO.clear() only supports the known SharedObjectTypes (CONNECTION, SLAVESERVER, PARTITIONSCHEMA, CLUSTERSCHEMA). For any other value it logs an error and throws KettleXMLException 'Invalid shared object type <type>' rather than silently clearing nothing.

Solutions

  1. Only pass CONNECTION, SLAVESERVER, PARTITIONSCHEMA, or CLUSTERSCHEMA to clear().
  2. Log/inspect the offending 'type' value in the message and fix the caller that produced it.
  3. If a new type is needed, update XmlFileSharedObjectsIO.clear()'s switch to handle it.
  4. Guard the call site by filtering types against the supported set before invoking clear.

Example fix

// before
xmlFileSharedObjectsIO.clear( someType ); // throws for unknown type
// after
if ( EnumSet.of( CONNECTION, SLAVESERVER, PARTITIONSCHEMA, CLUSTERSCHEMA ).contains( someType ) ) {
  xmlFileSharedObjectsIO.clear( someType );
}
Defensive patterns

Strategy: validation

Validate before calling

private static final Set<String> SUPPORTED = Set.of( "CONNECTION", "SLAVESERVER", "PARTITIONSCHEMA", "CLUSTERSCHEMA" );
if ( !SUPPORTED.contains( type ) ) { log.warn( "Unsupported type: " + type ); return; }

Type guard

boolean isSupportedSharedObjectType( String type ) {
  return type != null && Set.of( "CONNECTION", "SLAVESERVER", "PARTITIONSCHEMA", "CLUSTERSCHEMA" ).contains( type );
}

Try / catch

try {
  io.clear( type );
} catch ( KettleXMLException e ) {
  log.error( "Unsupported shared object type: " + type, e );
}

Prevention

When it happens

Trigger: Calling clear(type) with a SharedObjectsIO type value outside the four supported enum cases — e.g. a newly added enum constant not yet handled by this implementation, or a null/unknown type.

Common situations: Upgrading Pentaho and passing a newer shared object type to an older XmlFileSharedObjectsIO; typos when constructing a type value; code iterating over all types including unsupported ones.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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

Appendix: source

Thrown at core/src/main/java/org/pentaho/di/shared/XmlFileSharedObjectsIO.java:283

      lock();
      initialize();
      switch ( SharedObjectType.valueOf( type.toUpperCase() ) ) {
        case CONNECTION:
          connectionsNodes.clear();
          break;
        case SLAVESERVER:
          slaveServersNodes.clear();
          break;
        case PARTITIONSCHEMA:
          partitionSchemaNodes.clear();
          break;
        case CLUSTERSCHEMA:
          clusterSchemaNodes.clear();
          break;
        default:
          // unsupported type
          log.error( " Invalid Shared Object type " + type );
          throw new KettleXMLException( "Invalid shared object type " + type );
      }
      saveToFile();
    } finally {
      unlock();
    }
  }

  @Override
  public void lock() {
    // Lock the SharedObjectsIO for exclusive access
    lock.lock();
  }

  @Override
  public void unlock() {
    // Unlock the SharedObjectsIO after exclusive access is no longer needed
    lock.unlock();
  }

View on GitHub (pinned to f3058517a1)