{"record":{"id":"ff524ea2ad31c5c7","repo":"pentaho/pentaho-kettle","slug":"mailinput-error-receiveddatesearchtermempty","errorCode":"MailInput.Error.ReceivedDateSearchTermEmpty","errorMessage":"MailInput.Error.ReceivedDateSearchTermEmpty","messagePattern":"MailInput\\.Error\\.ReceivedDateSearchTermEmpty","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":421,"sourceCode":"      }\n      data.rowlimit = limit;\n    }\n    Date beginDate = null;\n    Date endDate = null;\n    SimpleDateFormat df = new SimpleDateFormat( MailInputMeta.DATE_PATTERN );\n\n    // check search terms\n    // 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;","sourceCodeStart":403,"sourceCodeEnd":439,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/email-messages/impl/src/main/java/org/pentaho/di/trans/steps/mailinput/MailInput.java#L403-L439","documentation":"MailInput.init() validates the 'condition on received date' configuration: when the condition is EQUAL, GREATER, or SMALLER, the single received-date field (ReceivedDate1) must be non-empty; otherwise this KettleException is thrown during step initialization. The library needs a concrete date to build the ReceivedDateTerm search filter.","triggerScenarios":"Starting the MailInput transformation with 'Condition on received date' set to equal/greater/smaller but the received date field left blank or a variable resolving to empty.","commonSituations":"Date supplied via environment variable that is undefined in the runtime environment; user configured the condition but forgot the date picker field; copying step metadata between environments losing the date value.","solutions":["Enter a value in the 'received date' field of the MailInput step dialog","Ensure any ${VARIABLE} used for the date is defined at runtime","Use the expected date format configured in the step","If no date filtering is wanted, set the condition to 'none' instead of leaving the date empty"],"exampleFix":"// before\nrealBeginDate = environmentSubstitute( meta.getReceivedDate1() ); // \"\" -> throws\n// after\nString realBeginDate = environmentSubstitute( meta.getReceivedDate1() );\nif ( Utils.isEmpty( realBeginDate ) ) {\n  realBeginDate = \"2024/01/01\"; // or fail fast with a clear dialog-level validation\n}","handlingStrategy":"validation","validationCode":"String realDate = environmentSubstitute( meta.getReceivedDate1() );\nif ( meta.getConditionOnReceivedDate() != MailConnectionMeta.CONDITION_DATE_NONE\n  && Utils.isEmpty( realDate ) ) {\n  throw new IllegalArgumentException( \"Received date is required for the selected condition\" );\n}","typeGuard":null,"tryCatchPattern":"try {\n  init();\n} catch ( KettleException e ) {\n  logError( \"MailInput init failed: \" + e.getMessage() );\n  setErrors( 1 );\n  stopAll();\n}","preventionTips":["Always pair a date condition with a concrete date value","Define environment variables in kettle.properties before deploying","Use the step dialog's validation; avoid blank-but-selected conditions","Prefer condition 'none' when date filtering is not needed"],"tags":["kettle","pdi","email","validation","date-filter","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"}