pentaho/pentaho-kettle · critical · KettleException
Could not connect to repository: ...
Error message
Could not connect to repository: ...
What it means
PanCommandExecutor.initializeRepository throws KettleException when no RepositoriesMeta matches the repository name supplied with -rep. repositoryMeta == null means the named repository is not defined in repositories.xml, so a connection is impossible. An error is also logged before throwing.
Solutions
- Run `pan -listrep` to see available repository names and use an exact match
- Create/fix repositories.xml (connect once in Spoon) with the named repository
- Point KETTLE_HOME (or -Dpentaho.repositories.dir) to the directory holding the correct repositories.xml
- If no repository is needed, omit -rep and pass -file plus -local instead
Example fix
// before pan.sh -rep:ProductionRepo -trans:t.kjb // after: verify name first pan.sh -listrep pan.sh -rep:production -user:admin -pass:... -trans:t.kjb
Defensive patterns
Strategy: validation
Validate before calling
RepositoriesMeta reposMeta = new RepositoriesMeta();
reposMeta.readData();
boolean found = java.util.Arrays.stream(reposMeta.getRepositoryDialogNames())
.anyMatch(n -> n != null && n.equals(repoName));
if (!found) throw new IllegalStateException("Repository '" + repoName + "' not in repositories.xml; run pan -listrep"); Type guard
static boolean repositoryExists(RepositoriesMeta meta, String name) {
if (name == null) return false;
for (int i = 0; i < meta.nrRepositories(); i++) {
if (name.equals(meta.getRepository(i).getName())) return true;
}
return false;
} Try / catch
try {
executor.initializeRepository(params);
} catch (KettleException e) {
if (e.getMessage().startsWith("Could not connect to repository")) {
throw new ConfigurationException("Repository '" + params.getRepoName() + "' undefined — run 'pan -listrep' and check KETTLE_HOME", e);
}
throw e;
} Prevention
- Run pan -listrep in CI to verify repository names before jobs
- Keep repositories.xml under version control / configuration management
- Set KETTLE_HOME explicitly in launch scripts
- Match repository names exactly (case-sensitive)
When it happens
Trigger: Running pan with -rep:<name> where <name> has no matching RepositoryMeta in repositories.xml (or repositories.xml is missing/empty and no such name exists).
Common situations: Misspelled repository name; running pan on a machine where repositories.xml was never created (Spoon never run locally); repository defined in a different KETTLE_HOME user directory.
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
- Could not execute specified in a repository since we're not…
- ExecuteJobServlet.Error.UnableToFindRepository
- Invalid repository type
- JobJob.Exception.ReferencedTransformationIdIsNull
- JobTrans.Exception.ReferencedTransformationIdIsNull
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/6d1a41130150d5e8.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/pan/PanCommandExecutor.java:317
*
* @link https://github.com/pentaho/pentaho-kettle/blob/8.0.0.0-R/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/PurRepositoryConnector.java#L97-L101
* @link https://github.com/pentaho/pentaho-kettle/blob/8.0.0.0-R/plugins/pur/core/src/main/java/org/pentaho/di/repository/pur/WebServiceManager.java#L130-L133
*/
if ( isEnabled( params.getTrustRepoUser() ) ) {
System.setProperty( "pentaho.repository.client.attemptTrust", "Y" );
}
// Load repository metadata
RepositoryMeta repositoryMeta = loadRepositoryConnection(
params.getRepoName(),
"Pan.Log.LoadingAvailableRep",
"Pan.Error.NoRepsDefined",
"Pan.Log.FindingRep"
);
if ( repositoryMeta == null ) {
getLog().logError( BaseMessages.getString( getPkgClazz(), "Pan.Error.CanNotConnectRep" ) );
throw new KettleException( "Could not connect to repository: " + params.getRepoName() );
}
// Establish repository connection
this.repository = establishRepositoryConnection(
repositoryMeta,
params.getRepoUsername(),
params.getRepoPassword(),
RepositoryOperation.EXECUTE_TRANSFORMATION
);
} else {
// No repository parameters provided, keep repository as null
this.repository = null;
}
}
public int printVersion() {
printVersion( "Pan.Log.KettleVersion" );
return CommandExecutorCodes.Pan.KETTLE_VERSION_PRINT.getCode();View on GitHub (pinned to f3058517a1)