pentaho/pentaho-kettle · error · KettleException

SalesforceInput.Error.StartDateTooOlder

SalesforceInput.Error.StartDateTooOlder

Error message

SalesforceInput.Error.StartDateTooOlder

What it means

setCalendar() computes the day difference between startDate and endDate and throws this KettleException when the range exceeds 30 days. Salesforce date-based query/retrieval windows are deliberately capped at one month in this wrapper.

Solutions

  1. Split the date range into chunks of 30 days or fewer and run setCalendar/query per chunk.
  2. Narrow the requested window to a single month in the step configuration.
  3. Add scheduler logic that keeps track of the last processed date and only queries the trailing 30-day window each run.
  4. Use getUpdated/getDeleted semantics via a recurring short-window job rather than one large backfill.

Example fix

// before
conn.setCalendar(filter, cal(2026, 1, 1), cal(2026, 12, 31)); // 364 days
// after
GregorianCalendar end = cal(2026, 1, 31); // <= 30 days after start
conn.setCalendar(filter, cal(2026, 1, 1), end);
Defensive patterns

Strategy: validation

Validate before calling

long diffDays = (endCal.getTimeInMillis() - startCal.getTimeInMillis()) / 86400000L;
if (diffDays > 30) {
  throw new IllegalArgumentException("Range exceeds 30 days: " + diffDays);
}

Type guard

boolean withinLimit = java.time.temporal.ChronoUnit.DAYS.between(start, end) <= 30;

Try / catch

try {
  conn.setCalendar(recordsFilter, startCal, endCal);
} catch (KettleException e) {
  if (e.getMessage().contains("StartDateTooOlder")) {
    logError("Range > 30 days; chunk the window");
  }
}

Prevention

When it happens

Trigger: Calling setCalendar where endDate - startDate > 30 days, e.g. a quarterly or yearly range requested for RECORDS_FILTER_UPDATED/DELETED queries.

Common situations: Users asking for a quarter's worth of updated records in one run; variables like ${YEAR_START}/${YEAR_END} spanning a year; automated jobs that never chunked the range.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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

Appendix: source

Thrown at plugins/salesforce/core/src/main/java/org/pentaho/di/trans/steps/salesforce/SalesforceConnection.java:189

  public void setQueryAll( boolean value ) {
    this.queryAll = value;
  }

  public void setCalendar( int recordsFilter, GregorianCalendar startDate, GregorianCalendar endDate ) throws KettleException {
    this.startDate = startDate;
    this.endDate = endDate;
    this.recordsFilter = recordsFilter;
    if ( this.startDate == null || this.endDate == null ) {
      throw new KettleException( BaseMessages.getString( PKG, "SalesforceInput.Error.EmptyStartDateOrEndDate" ) );
    }
    if ( this.startDate.getTime().compareTo( this.endDate.getTime() ) >= 0 ) {
      throw new KettleException( BaseMessages.getString( PKG, "SalesforceInput.Error.WrongDates" ) );
    }
    // Calculate difference in days
    long diffDays =
      ( this.endDate.getTime().getTime() - this.startDate.getTime().getTime() ) / ( 24 * 60 * 60 * 1000 );
    if ( diffDays > 30 ) {
      throw new KettleException( BaseMessages.getString( PKG, "SalesforceInput.Error.StartDateTooOlder" ) );
    }
  }

  public void setSQL( String sql ) {
    this.sql = sql;
  }

  public void setFieldsList( String fieldsList ) {
    this.fieldsList = fieldsList;
  }

  public void setModule( String module ) {
    this.module = module;
  }

  public String getURL() {
    return this.url;
  }

View on GitHub (pinned to f3058517a1)