pentaho/pentaho-kettle · error · KettleException
Attempting to create PDI Repository with no Active…
Error message
Attempting to create PDI Repository with no Active PentahoSession. This is not allowed.
What it means
IRepositoryFactory.connect resolves the current Pentaho session via PentahoSessionHolder.getSession() before creating a PDI repository. If no session is active, the factory cannot authenticate or cache a repository for a user, so it throws a KettleException rather than proceeding unauthenticated. The debug log notes it will not attempt unauthenticated loading.
Solutions
- Ensure a PentahoSession exists by logging into the Pentaho server or running within an authenticated request context.
- Manually set a session via PentahoSessionHolder.setSession(...) before calling connect (e.g., a StandaloneSession with the appropriate user).
- Use the explicit username/password repository connect API (Repository.connect(user, pass)) instead of the session-based factory when outside the Pentaho server.
- If in a background job, propagate the caller's session to the worker thread.
Example fix
// before
Repository repo = repositoryFactory.connect(repositoryName); // no session
// after
PentahoSessionHolder.setSession(new StandaloneSession("admin"));
Repository repo = repositoryFactory.connect(repositoryName); Defensive patterns
Strategy: try-catch
Validate before calling
if (PentahoSessionHolder.getSession() == null) {
PentahoSessionHolder.setSession(new StandaloneSession("admin"));
} Try / catch
try { repo = factory.connect(name); }
catch (KettleException e) { if (e.getMessage().contains("no Active PentahoSession")) { initSession(); } } Prevention
- Always connect within an authenticated Pentaho context
- Set up a session explicitly in standalone/test code
When it happens
Trigger: Calling connect(repositoryName) (or testConnectNoSession, firstRepo, repo) outside a Pentaho web request / without an authenticated PentahoSession in the PentahoSessionHolder — e.g., from a standalone JVM, a background thread, or before login.
Common situations: Running PUR repository connection code in a command-line tool or test without initializing a Pentaho session; calling connect from a non-web thread where the session holder wasn't populated; forgetting to log into the Pentaho server first.
Related errors
- Browser session authentication requested but no JSESSIONID…
- Failed to create repository for user
- Session-based authentication is enabled but no valid…
- AbsSecurityProvider.ERROR_0002_UNABLE_TO_ACCESS_IS_ALLOWED
- AddSequenceMeta.Exception.UnableToReadStepInfo
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/fe9d91b776db91e0.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/pur/core/src/main/java/org/pentaho/di/repository/utils/IRepositoryFactory.java:83
this( new DefaultRepositoryFactory() );
}
public CachingRepositoryFactory( IRepositoryFactory delegate ) {
this.delegate = delegate;
}
@Override
public void setRepositoryId( String id ) {
delegate.setRepositoryId( id );
}
@Override
public Repository connect( String repositoryName ) throws KettleException {
IPentahoSession session = PentahoSessionHolder.getSession();
if ( session == null ) {
logger.debug( "No active Pentaho Session, attempting to load PDI repository unauthenticated." );
throw new KettleException( "Attempting to create PDI Repository with no Active PentahoSession. "
+ "This is not allowed." );
}
ICacheManager cacheManager = PentahoSystem.getCacheManager( session );
String sessionName = session.getName();
try {
return (Repository) cacheManager.getOrCreateFromRegionCache( REGION, sessionName, () -> {
logger.debug( "Repository not cached for user: " + sessionName + ". Creating new Repository." );
try {
return delegate.connect( repositoryName );
} catch ( KettleException e ) {
throw new IllegalStateException( "Failed to create repository for user: " + sessionName, e );
}
} );
} catch ( IllegalStateException e ) {
if ( e.getCause() instanceof KettleException kettleException ) {
throw kettleException;
}View on GitHub (pinned to f3058517a1)