pentaho/pentaho-kettle · error · KettleException

Error finding ID for directory [ + repositoryDirectory + ]…

Error message

Error finding ID for directory [ + repositoryDirectory + ] and name [ + name + ]

What it means

In KettleFileRepository, object IDs are filenames relative to the base directory. getObjectId() resolves the ID for a named object in a directory by computing that filename; any exception during resolution (bad directory, invalid name, extension problems) is wrapped in this KettleException. Callers include match(), getDatabaseID(), getJobId(), and getTransformationID().

Solutions

  1. Check the chained cause for the underlying resolution failure.
  2. Refresh/reload the RepositoryDirectory tree from the repository before lookups.
  3. Sanitize object names — remove filesystem-illegal characters before calling.
  4. Confirm the object's extension/type is supported by the file repository mapping.

Example fix

// before: stale directory handle
ObjectId id = repo.getTransformationID(name, staleDir);

// after: re-resolve the directory tree first
RepositoryDirectoryInterface dir = repo.loadRepositoryDirectoryTree()
    .findDirectory(dirPath);
ObjectId id = repo.getTransformationID(sanitize(name), dir);
Defensive patterns

Strategy: validation

Validate before calling

// reload the directory tree and sanitize names before lookups
RepositoryDirectoryInterface dir = repo.loadRepositoryDirectoryTree().findDirectory(dirPath);
String safeName = name.replaceAll("[\\/:*?\"<>|]", "_");

Type guard

boolean directoryUsable(RepositoryDirectoryInterface d) {
  return d != null && d.getPath() != null;
}

Try / catch

try {
  ObjectId id = repo.getTransformationID(name, dir);
} catch (KettleException e) {
  if (e.getMessage().startsWith("Error finding ID for directory")) {
    log.error("Lookup failed for [" + name + "] in [" + dir + "]: " + e.getCause());
  } else { throw e; }
}

Prevention

When it happens

Trigger: Calling getDatabaseID/getJobId/getTransformationID (or delObject/match paths) with a name that cannot be mapped to a file, or a repository directory whose path cannot be computed — e.g. directory with null/unset path, or name containing illegal filename characters.

Common situations: Looking up an object in a directory object that was never loaded/refreshed from the file repository; object names containing characters invalid in filenames (slash, colon); stale directory references after the underlying folder tree was moved.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/repository/filerep/KettleFileRepository.java:512

    return new ObjectId[] {};
  }

  public ObjectId[] getDatabaseAttributeIDs( ObjectId id_database ) throws KettleException {
    return new ObjectId[] {};
  }

  private ObjectId getObjectId( RepositoryDirectoryInterface repositoryDirectory, String name, String extension ) throws KettleException {
    try {
      String filename = calcFilename( repositoryDirectory, name, extension );
      if ( !KettleVFS.getInstance( DefaultBowl.getInstance() ).getFileObject( filename ).exists() ) {
        return null;
      }

      // The ID is the filename relative to the base directory, including the file extension
      //
      return new StringObjectId( calcObjectId( repositoryDirectory, name, extension ) );
    } catch ( Exception e ) {
      throw new KettleException( "Error finding ID for directory ["
        + repositoryDirectory + "] and name [" + name + "]", e );
    }
  }

  @Override
  public ObjectId getDatabaseID( String name ) throws KettleException {
    ObjectId match = getObjectId( null, name, EXT_DATABASE );
    if ( match == null ) {
      // exact match failed, trying to find the DB case-insensitively
      ObjectId[] existingIds = getDatabaseIDs( false );
      String[] existingNames = getDatabaseNames( existingIds );
      int index = DatabaseMeta.indexOfName( existingNames, name );
      if ( index != -1 ) {
        return getObjectId( null, existingNames[ index ], EXT_DATABASE );
      }
    }

    return match;

View on GitHub (pinned to f3058517a1)