pentaho/pentaho-kettle · error · KettleException

Unable to load job entry of type 'sql' from the repository…

Error message

Unable to load job entry of type 'sql' from the repository with idJobentry=

What it means

KettleException thrown by JobEntrySQL.loadRep when loading a 'sql' job entry's attributes (SQL from file flag, SQL filename, database connection) from the repository fails with a KettleDatabaseException, including failure of loadDatabaseMetaFromJobEntryAttribute to resolve the connection.

Solutions

  1. Verify the database connection referenced by the SQL entry still exists in the repository.
  2. Test repository connectivity and re-authenticate.
  3. Check R_JOBENTRY_ATTRIBUTE rows for the given idJobentry (CONNECTION_TAG, SQLFILENAME_TAG).
  4. Recreate the connection in Spoon and re-save the job entry.

Example fix

// before
sqlEntry.loadRep(rep, metaStore, idJobentry, databases, slaveServers);
// after
List<DatabaseMeta> dbs = rep != null ? rep.getDatabases() : null;
boolean connExists = dbs != null && dbs.stream().anyMatch(d -> d.getName().equals(expectedConn));
if (!connExists) {
  logError("Connection '" + expectedConn + "' missing; fix before loading entry");
}
sqlEntry.loadRep(rep, metaStore, idJobentry, databases, slaveServers);
Defensive patterns

Strategy: validation

Validate before calling

// Ensure the referenced connection exists before loading
List<DatabaseMeta> dbs = rep.getDatabases();
if (dbs.stream().noneMatch(d -> d.getName().equals(expectedConnectionName))) {
  throw new KettleException("Connection '" + expectedConnectionName + "' not found in repository");
}

Try / catch

try {
  sqlEntry.loadRep(rep, metaStore, idJobentry, databases, slaveServers);
} catch (KettleException e) {
  logError("Repository load failed for idJobentry=" + idJobentry + " cause=" + e.getCause(), e);
}

Prevention

When it happens

Trigger: Calling loadRep for a 'sql' job entry when getJobEntryAttributeString or loadDatabaseMetaFromJobEntryAttribute raises KettleDatabaseException: repository connection failure, missing R_JOBENTRY_ATTRIBUTE rows, or referenced database metadata (ID_DATABASE) cannot be loaded.

Common situations: The SQL entry's referenced database connection was deleted from the repository; repository DB unreachable; job moved between repositories where connection ids no longer match.

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/4b8518c5a2f2dfe4. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/job/entries/sql/JobEntrySQL.java:165

      if ( sSubs != null && sSubs.equalsIgnoreCase( "T" ) ) {
        useVariableSubstitution = true;
      }

      String ssql = rep.getJobEntryAttributeString( idJobentry, SQLFROMFILE_TAG );
      if ( ssql != null && ssql.equalsIgnoreCase( "T" ) ) {
        sqlFromFile = true;
      }

      String ssendOneStatement = rep.getJobEntryAttributeString( idJobentry, SEND_ONE_STATEMENT_TAG );
      if ( ssendOneStatement != null && ssendOneStatement.equalsIgnoreCase( "T" ) ) {
        sendOneStatement = true;
      }

      sqlFilename = rep.getJobEntryAttributeString( idJobentry, SQLFILENAME_TAG );

      databaseMeta = rep.loadDatabaseMetaFromJobEntryAttribute( idJobentry, CONNECTION_TAG, ID_DATABASE, databases );
    } catch ( KettleDatabaseException dbe ) {
      throw new KettleException( "Unable to load job entry of type 'sql' from the repository with idJobentry="
        + idJobentry, dbe );
    }
  }

  // Save the attributes of this job entry
  //
  public void saveRep( Repository rep, IMetaStore metaStore, ObjectId idJob ) throws KettleException {
    try {
      rep.saveDatabaseMetaJobEntryAttribute( idJob, getObjectId(), CONNECTION_TAG, ID_DATABASE, databaseMeta );

      rep.saveJobEntryAttribute( idJob, getObjectId(), SQL_TAG, sql );
      rep.saveJobEntryAttribute( idJob, getObjectId(), USE_VARIABLE_SUBSTITUTION_TAG, useVariableSubstitution
        ? "T" : "F" );
      rep.saveJobEntryAttribute( idJob, getObjectId(), SQLFROMFILE_TAG, sqlFromFile ? "T" : "F" );
      rep.saveJobEntryAttribute( idJob, getObjectId(), SQLFILENAME_TAG, sqlFilename );
      rep.saveJobEntryAttribute( idJob, getObjectId(), SEND_ONE_STATEMENT_TAG, sendOneStatement ? "T" : "F" );
    } catch ( KettleDatabaseException dbe ) {
      throw new KettleException(

View on GitHub (pinned to f3058517a1)