{"record":{"id":"8aa2f4d88aa99a32","repo":"pentaho/pentaho-kettle","slug":"trans-exception-maximumdateconnectioncouldnotbefound","errorCode":null,"errorMessage":"Trans.Exception.MaximumDateConnectionCouldNotBeFound","messagePattern":"Trans\\.Exception\\.MaximumDateConnectionCouldNotBeFound","errorType":"exception","errorClass":"KettleTransException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/Trans.java","lineNumber":2348,"sourceCode":"                  if ( log.isDetailed() ) {\n                    log.logDetailed( BaseMessages.getString( PKG, \"Trans.Log.LastDateFoundOnTheMaxdateConnection\" )\n                      + r1 );\n                  }\n                  endDate.setTime( (long) ( maxvalue.getTime() + ( transMeta.getMaxDateOffset() * 1000 ) ) );\n                }\n              } else {\n                if ( log.isDetailed() ) {\n                  log.logDetailed( BaseMessages.getString( PKG, \"Trans.Log.NoLastDateFoundOnTheMaxdateConnection\" ) );\n                }\n              }\n            } catch ( KettleException e ) {\n              throw new KettleTransException( BaseMessages.getString( PKG, \"Trans.Exception.ErrorConnectingToDatabase\",\n                \"\" + transMeta.getMaxDateConnection() ), e );\n            } finally {\n              maxdb.close();\n            }\n          } else {\n            throw new KettleTransException( BaseMessages.getString( PKG,\n              \"Trans.Exception.MaximumDateConnectionCouldNotBeFound\", \"\" + transMeta.getMaxDateConnection() ) );\n          }\n        }\n\n        // Determine the last date of all dependend tables...\n        // Get the maximum in depdate...\n        if ( transMeta.nrDependencies() > 0 ) {\n          if ( log.isDetailed() ) {\n            log.logDetailed( BaseMessages.getString( PKG, \"Trans.Log.CheckingForMaxDependencyDate\" ) );\n          }\n          //\n          // Maybe one of the tables where this transformation is dependent on has changed?\n          // If so we need to change the start-date!\n          //\n          depDate = Const.MIN_DATE;\n          Date maxdepdate = Const.MIN_DATE;\n          if ( lastr != null && lastr.length > 0 ) {\n            Date dep = (Date) lastr[ 1 ]; // #1: last depdate","sourceCodeStart":2330,"sourceCodeEnd":2366,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/Trans.java#L2330-L2366","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-add the missing database connection to the transformation or environment metadata","Fix the connection name referenced by the max date setting so it resolves","Export transformations with referenced connections included","Verify transMeta.getMaxDateConnection() returns a valid DatabaseMeta programmatically"],"exampleFix":"// before: connection deleted from metadata\ntransMeta.setMaxDateComparator(null); // connection dangling\n// after: ensure connection exists before executing\nif (transMeta.findDatabase(maxDateConnName) == null) {\n  transMeta.addDatabase(new DatabaseMeta(\"logdb\", \"POSTGRESQL\", \"Native\", \"u\", \"p\", \"5432\", \"host\", \"db\"));\n}","handlingStrategy":"validation","validationCode":"if (transMeta.getMaxDateConnection() != null &&\n    transMeta.findDatabase(transMeta.getMaxDateConnection().getName()) == null) {\n  throw new IllegalStateException(\"Max date connection not found: \" + transMeta.getMaxDateConnection().getName());\n}","typeGuard":null,"tryCatchPattern":"try {\n  trans.execute(args);\n} catch (KettleTransException e) {\n  if (e.getMessage().contains(\"MaximumDateConnectionCouldNotBeFound\")) {\n    // re-register the missing DatabaseMeta, then retry\n  } else throw e;\n}","preventionTips":["Export transformations together with their referenced connections","Avoid deleting shared database connections still referenced by jobs/transes","Resolve connections via names that exist in the target repository/environment","Validate all referenced DatabaseMeta before execution"],"tags":["kettle","database","configuration","maxdate"],"backgroundTag":"resource-not-found","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}