pentaho/pentaho-kettle · error · KettleTransException

Trans.Exception.MaximumDateConnectionCouldNotBeFound

Error message

Trans.Exception.MaximumDateConnectionCouldNotBeFound

What it means

If a transformation specifies a max date lookup but the max date connection (DatabaseMeta) itself cannot be found/resolved, Trans throws KettleTransException with Trans.Exception.MaximumDateConnectionCouldNotBeFound naming the connection. The transformation cannot compute its date range without this connection.

Solutions

  1. Re-add the missing database connection to the transformation or environment metadata
  2. Fix the connection name referenced by the max date setting so it resolves
  3. Export transformations with referenced connections included
  4. Verify transMeta.getMaxDateConnection() returns a valid DatabaseMeta programmatically

Example fix

// before: connection deleted from metadata
transMeta.setMaxDateComparator(null); // connection dangling
// after: ensure connection exists before executing
if (transMeta.findDatabase(maxDateConnName) == null) {
  transMeta.addDatabase(new DatabaseMeta("logdb", "POSTGRESQL", "Native", "u", "p", "5432", "host", "db"));
}
Defensive patterns

Strategy: validation

Validate before calling

if (transMeta.getMaxDateConnection() != null &&
    transMeta.findDatabase(transMeta.getMaxDateConnection().getName()) == null) {
  throw new IllegalStateException("Max date connection not found: " + transMeta.getMaxDateConnection().getName());
}

Try / catch

try {
  trans.execute(args);
} catch (KettleTransException e) {
  if (e.getMessage().contains("MaximumDateConnectionCouldNotBeFound")) {
    // re-register the missing DatabaseMeta, then retry
  } else throw e;
}

Prevention

When it happens

Trigger: transMeta.getMaxDateConnection() returns a value (non-null) that is not a valid/available DatabaseMeta - e.g. the code path checks the connection object and it is not usable, so the else branch throws naming the connection.

Common situations: Transformation references a database connection that was deleted from the repository/environment; connection defined in a shared metadata source not loaded; exported transformation missing its connection definition.

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/8aa2f4d88aa99a32. Report an issue: GitHub.

Appendix: source

Thrown at engine/src/main/java/org/pentaho/di/trans/Trans.java:2348

                  if ( log.isDetailed() ) {
                    log.logDetailed( BaseMessages.getString( PKG, "Trans.Log.LastDateFoundOnTheMaxdateConnection" )
                      + r1 );
                  }
                  endDate.setTime( (long) ( maxvalue.getTime() + ( transMeta.getMaxDateOffset() * 1000 ) ) );
                }
              } else {
                if ( log.isDetailed() ) {
                  log.logDetailed( BaseMessages.getString( PKG, "Trans.Log.NoLastDateFoundOnTheMaxdateConnection" ) );
                }
              }
            } catch ( KettleException e ) {
              throw new KettleTransException( BaseMessages.getString( PKG, "Trans.Exception.ErrorConnectingToDatabase",
                "" + transMeta.getMaxDateConnection() ), e );
            } finally {
              maxdb.close();
            }
          } else {
            throw new KettleTransException( BaseMessages.getString( PKG,
              "Trans.Exception.MaximumDateConnectionCouldNotBeFound", "" + transMeta.getMaxDateConnection() ) );
          }
        }

        // Determine the last date of all dependend tables...
        // Get the maximum in depdate...
        if ( transMeta.nrDependencies() > 0 ) {
          if ( log.isDetailed() ) {
            log.logDetailed( BaseMessages.getString( PKG, "Trans.Log.CheckingForMaxDependencyDate" ) );
          }
          //
          // Maybe one of the tables where this transformation is dependent on has changed?
          // If so we need to change the start-date!
          //
          depDate = Const.MIN_DATE;
          Date maxdepdate = Const.MIN_DATE;
          if ( lastr != null && lastr.length > 0 ) {
            Date dep = (Date) lastr[ 1 ]; // #1: last depdate

View on GitHub (pinned to f3058517a1)