{"record":{"id":"f62a0a2068b487d7","repo":"pentaho/pentaho-kettle","slug":"mailinput-error-receiveddatessearchtermempty","errorCode":"MailInput.Error.ReceivedDatesSearchTermEmpty","errorMessage":"MailInput.Error.ReceivedDatesSearchTermEmpty","messagePattern":"MailInput\\.Error\\.ReceivedDatesSearchTermEmpty","errorType":"exception","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/email-messages/impl/src/main/java/org/pentaho/di/trans/steps/mailinput/MailInput.java","lineNumber":429,"sourceCode":"    // Received Date\n    try {\n      String realBeginDate;\n\n      switch ( meta.getConditionOnReceivedDate() ) {\n        case MailConnectionMeta.CONDITION_DATE_EQUAL:\n        case MailConnectionMeta.CONDITION_DATE_GREATER:\n        case MailConnectionMeta.CONDITION_DATE_SMALLER:\n          realBeginDate = environmentSubstitute( meta.getReceivedDate1() );\n          if ( Utils.isEmpty( realBeginDate ) ) {\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"MailInput.Error.ReceivedDateSearchTermEmpty\" ) );\n          }\n          beginDate = df.parse( realBeginDate );\n          break;\n        case MailConnectionMeta.CONDITION_DATE_BETWEEN:\n          realBeginDate = environmentSubstitute( meta.getReceivedDate1() );\n          if ( Utils.isEmpty( realBeginDate ) ) {\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"MailInput.Error.ReceivedDatesSearchTermEmpty\" ) );\n          }\n          beginDate = df.parse( realBeginDate );\n          String realEndDate = environmentSubstitute( meta.getReceivedDate2() );\n          if ( Utils.isEmpty( realEndDate ) ) {\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"MailInput.Error.ReceivedDatesSearchTermEmpty\" ) );\n          }\n          endDate = df.parse( realEndDate );\n          break;\n        default:\n          break;\n      }\n    } catch ( Exception e ) {\n      logError( BaseMessages.getString( PKG, \"MailInput.Error.SettingSearchTerms\", e.getMessage() ) );\n      setErrors( 1 );\n      stopAll();\n    }","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/email-messages/impl/src/main/java/org/pentaho/di/trans/steps/mailinput/MailInput.java#L411-L447","documentation":"For the BETWEEN condition, init() requires both start and end received dates. This key is thrown when the FIRST date of the between range (ReceivedDate1) is empty. The library cannot build a between-range search term without a lower bound.","triggerScenarios":"MailInput step with 'Condition on received date' = between, and the begin-date field (ReceivedDate1) blank or a variable resolving to empty at init time.","commonSituations":"Undefined environment variable feeding the start date; user filled only the end date; step exported/imported without the begin date value.","solutions":["Fill in the begin date for the between condition in the step dialog","Ensure the variable used for the start date is defined in the runtime environment (kettle.properties, parameter)","Switch the condition to equal/greater/smaller if only one bound is intended","Validate step settings in the dialog before saving the transformation"],"exampleFix":"// before\nrealBeginDate = environmentSubstitute( meta.getReceivedDate1() ); // empty -> throws\n// after\nString realBeginDate = environmentSubstitute( meta.getReceivedDate1() );\nif ( Utils.isEmpty( realBeginDate ) ) {\n  throw new KettleException( \"Received date 'from' must be set for BETWEEN condition\" ); // fail at design time\n}","handlingStrategy":"validation","validationCode":"if ( meta.getConditionOnReceivedDate() == MailConnectionMeta.CONDITION_DATE_BETWEEN\n  && Utils.isEmpty( environmentSubstitute( meta.getReceivedDate1() ) ) ) {\n  throw new IllegalArgumentException( \"BETWEEN requires a begin received date\" );\n}","typeGuard":null,"tryCatchPattern":"try {\n  init();\n} catch ( KettleException e ) {\n  logError( \"MailInput init failed (between begin date): \" + e.getMessage() );\n  setErrors( 1 );\n}","preventionTips":["Fill both bounds whenever BETWEEN is selected","Define the start-date variable in the runtime environment","Add design-time validation in custom wrapping metadata"],"tags":["kettle","pdi","email","validation","date-range","configuration"],"backgroundTag":"empty-required-field","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"}