pentaho/pentaho-kettle · error · KettleException

ERROR_0002_Cannot_Load_Job_From_Repository

ERROR_0002_Cannot_Load_Job_From_Repository

Error message

JobEntryCheckDbConnections.ERROR_0002_Cannot_Load_Job_From_Repository

What it means

loadRep throws KettleException with ERROR_0002 when loading the CheckDbConnections entry from the repository fails. It wraps repository read errors (including loadDatabaseMetaFromJobEntryAttribute failing to resolve the connection) and includes id_jobentry and the DB error message.

Solutions

  1. Re-create or re-import the missing database connection so the stored id_database resolves.
  2. Check the wrapped dbe message for the SQL failure and repair the repository DB connection.
  3. Re-save the job entry so connection attributes are rewritten against current R_DATABASE rows.
  4. Run repository upgrade scripts after a Pentaho version change.

Example fix

// before
connections[a] = rep.loadDatabaseMetaFromJobEntryAttribute( id_jobentry, "connection", a, "id_database", databases );
// after
DatabaseMeta db = rep.loadDatabaseMetaFromJobEntryAttribute( id_jobentry, "connection", a, "id_database", databases );
connections[a] = db != null ? db : DatabaseMeta.findDatabase( databases, fallbackName );
Defensive patterns

Strategy: validation

Validate before calling

// confirm all referenced connections still exist in the target repository
List<DatabaseMeta> dbs = rep.readDatabases();
for ( String connName : storedConnectionNames ) {
  if ( DatabaseMeta.findDatabase( dbs, connName ) == null ) {
    throw new IllegalStateException( "connection missing: " + connName );
  }
}

Try / catch

try { entry.loadRep( rep, metaStore, id_jobentry, databases, slaveServers ); } catch ( KettleException e ) { logError( "ERROR_0002 for " + id_jobentry + ": " + e.getMessage(), e ); }

Prevention

When it happens

Trigger: rep.loadDatabaseMetaFromJobEntryAttribute or getJobEntryAttributeString throwing because the referenced connection id no longer exists in R_DATABASE, or the repository connection fails.

Common situations: Jobs moved between repositories where database connections were not migrated; deleted shared connections; repository schema drift after upgrade.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


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

Appendix: source

Thrown at plugins/core/impl/src/main/java/org/pentaho/di/job/entries/checkdbconnection/JobEntryCheckDbConnections.java:246

  public void loadRep( Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases,
    List<SlaveServer> slaveServers ) throws KettleException {
    try {
      // How many connections?
      int argnr = rep.countNrJobEntryAttributes( id_jobentry, "id_database" );
      connections = new DatabaseMeta[argnr];
      waitfors = new String[argnr];
      waittimes = new int[argnr];
      // Read them all...
      for ( int a = 0; a < argnr; a++ ) {
        connections[a] =
          rep.loadDatabaseMetaFromJobEntryAttribute( id_jobentry, "connection", a, "id_database", databases );
        waitfors[a] = rep.getJobEntryAttributeString( id_jobentry, a, "waitfor" );
        waittimes[a] =
          getWaitByCode( Const.NVL( rep.getJobEntryAttributeString( id_jobentry, a, "waittime" ), "" ) );
      }
    } catch ( KettleException dbe ) {
      throw new KettleException( BaseMessages.getString(
        PKG, "JobEntryCheckDbConnections.ERROR_0002_Cannot_Load_Job_From_Repository", "" + id_jobentry, dbe
          .getMessage() ) );
    }
  }

  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId id_job ) throws KettleException {
    try {
      // save the arguments...
      if ( connections != null ) {
        for ( int i = 0; i < connections.length; i++ ) {
          rep.saveDatabaseMetaJobEntryAttribute(
            id_job, getObjectId(), i, "connection", "id_database", connections[i] );

          rep.saveJobEntryAttribute( id_job, getObjectId(), i, "waittime", getWaitTimeCode( waittimes[i] ) );
          rep.saveJobEntryAttribute( id_job, getObjectId(), i, "waitfor", waitfors[i] );
        }
      }
    } catch ( KettleDatabaseException dbe ) {

View on GitHub (pinned to f3058517a1)