pentaho/pentaho-kettle · error · KettleTransException
Trans.Exception.ErrorCalculatingDateRange
Error message
Trans.Exception.ErrorCalculatingDateRange
What it means
Thrown by Trans.beginProcessing() when calculating the transformation log table's date range fails with a generic KettleException. Kettle computes start/end dates (e.g. from the log table's previous records and a max date) so it can delete or expire old log rows before the run. Any database failure during that calculation (query, connection, schema issue) is wrapped in this exception.
Solutions
- Inspect the chained 'cause' exception to find the underlying SQL error and fix it first (connection, missing table, privileges).
- Verify the transformation log table exists in the target database with the expected schema; run 'SQL' generation in the Log tab or recreate the table.
- Test the configured database connection (Test button) and confirm the user has read/delete rights on the log table.
- Check date format/locale settings on the database connection if the cause shows date parsing failures.
Example fix
// before: log table missing -> cause: table not found Log table: trans_log (connection ETL_DB) // after: create the log table via the Log tab 'SQL' button or DDL CREATE TABLE trans_log (ID_BATCH INTEGER, CHANNEL_ID VARCHAR(255), LOG_DATE TIMESTAMP, ...);
Defensive patterns
Strategy: validation
Validate before calling
// Verify the trans log table exists and is queryable before beginProcessing
Database db = new Database(trans, logTable.getDatabaseMeta());
db.connect();
DatabaseMetaData md = db.getConnection().getMetaData();
ResultSet rs = md.getTables(null, null, "TRANS_LOG", null);
if (!rs.next()) throw new IllegalStateException("trans_log table missing"); Try / catch
try {
trans.beginProcessing();
} catch (KettleTransException e) {
if (e.getCause() instanceof KettleException) {
log.error("Date-range calc failed on log table: check cause", e.getCause());
}
} Prevention
- Generate and version-control log table DDL alongside the transformation.
- Test the log table connection after any DB maintenance or upgrade.
- Confirm the log user has SELECT and DELETE on log tables before deployments.
When it happens
Trigger: beginProcessing() calls the date-range calculation against the transformation LogTableConnectionInfo; the underlying SQL/round-trip throws KettleException, which is rethrown as KettleTransException(ErrorCalculatingDateRange, logTable).
Common situations: Transformation log table points to a database whose log table was dropped or altered (missing ID_*/LOG_DATE columns); database unreachable mid-startup; DB user lacking SELECT/DELETE privileges on the log table; date conversion issues with unusual DB date formats/timezones.
Understand the failure class
Background: "query failed", "%w: SQL error" — wrapped database query errors in Go libraries explained — this error's family across 3 libraries.
Related errors
- Trans.Exception.ConnectionCouldNotBeFound
- Trans.Exception.ErrorWritingLogRecordToTable
- Trans.Exception.UnableToBeginProcessingTransformation
- Trans.Exception.UnableToWriteMetricsInformationToLogTable
- Trans.Exception.UnableToWriteStepInformationToLogTable
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/44bf3457b06c1541.
Report an issue: GitHub.
Appendix: source
Thrown at engine/src/main/java/org/pentaho/di/trans/Trans.java:2449
}
}
// OK, now we have a date-range. See if we need to set a maximum!
if ( transMeta.getMaxDateDifference() > 0.0 && // Do we have a difference specified?
startDate.getTime() > Const.MIN_DATE.getTime() ) { // Is the startdate > Minimum?
// See if the end-date is larger then Start_date + DIFF?
Date maxdesired = new Date( startDate.getTime() + ( (long) transMeta.getMaxDateDifference() * 1000 ) );
// If this is the case: lower the end-date. Pick up the next 'region' next time around.
// We do this to limit the workload in a single update session (e.g. for large fact tables)
//
if ( endDate.compareTo( maxdesired ) > 0 ) {
endDate = maxdesired;
}
}
} catch ( KettleException e ) {
throw new KettleTransException( BaseMessages.getString( PKG, "Trans.Exception.ErrorCalculatingDateRange",
logTable ), e );
}
// Be careful, We DO NOT close the trans log table database connection!!!
// It's closed later in beginProcessing() to prevent excessive connect/disconnect repetitions.
}
/**
* Begin processing. Also handle logging operations related to the start of the transformation
*
* @throws KettleTransException the kettle trans exception
*/
public void beginProcessing() throws KettleTransException {
TransLogTable transLogTable = transMeta.getTransLogTable();
int intervalInSeconds = Const.toInt( environmentSubstitute( transLogTable.getLogInterval() ), -1 );
try {View on GitHub (pinned to f3058517a1)