{"record":{"id":"10cca074aba938f1","repo":"pentaho/pentaho-kettle","slug":"jobgetmailsfrompop-error-receiveddatessearchtermempty","errorCode":"JobGetMailsFromPOP.Error.ReceivedDatesSearchTermEmpty","errorMessage":"JobGetMailsFromPOP.Error.ReceivedDatesSearchTermEmpty","messagePattern":"JobGetMailsFromPOP\\.Error\\.ReceivedDatesSearchTermEmpty","errorType":"validation","errorClass":"KettleException","httpStatus":null,"severity":"error","filePath":"plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java","lineNumber":1098,"sourceCode":"      }\n      // check search terms\n      // Received Date\n      String realBeginDate;\n      switch ( getConditionOnReceivedDate() ) {\n        case MailConnectionMeta.CONDITION_DATE_EQUAL:\n        case MailConnectionMeta.CONDITION_DATE_GREATER:\n        case MailConnectionMeta.CONDITION_DATE_SMALLER:\n          realBeginDate = environmentSubstitute( getReceivedDate1() );\n          if ( Utils.isEmpty( realBeginDate ) ) {\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"JobGetMailsFromPOP.Error.ReceivedDateSearchTermEmpty\" ) );\n          }\n          beginDate = df.parse( realBeginDate );\n          break;\n        case MailConnectionMeta.CONDITION_DATE_BETWEEN:\n          realBeginDate = environmentSubstitute( getReceivedDate1() );\n          if ( Utils.isEmpty( realBeginDate ) ) {\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"JobGetMailsFromPOP.Error.ReceivedDatesSearchTermEmpty\" ) );\n          }\n          beginDate = df.parse( realBeginDate );\n          String realEndDate = environmentSubstitute( getReceivedDate2() );\n          if ( Utils.isEmpty( realEndDate ) ) {\n            throw new KettleException( BaseMessages.getString(\n              PKG, \"JobGetMailsFromPOP.Error.ReceivedDatesSearchTermEmpty\" ) );\n          }\n          endDate = df.parse( realEndDate );\n          break;\n        default:\n          break;\n      }\n\n      String realServer = getRealServername();\n      String realUsername = getRealUsername();\n      String realPassword = getRealPassword( getPassword() );\n      String realFilenamePattern = getRealFilenamePattern();","sourceCodeStart":1080,"sourceCodeEnd":1116,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java#L1080-L1116","documentation":"In the 'Get Mails (POP3/IMAP)' job entry, when the condition on the received date is BETWEEN, both a begin date and an end date search term are required. The entry resolves each date field through environmentSubstitute() and throws this KettleException if the resolved begin date (getReceivedDate1()) is empty. It exists to fail fast before parsing dates or opening the mail connection.","triggerScenarios":"execute() is called with getConditionOnReceivedDate() == CONDITION_DATE_BETWEEN and environmentSubstitute(getReceivedDate1()) returns null or an empty string — i.e. the 'First date' field is blank or its variable resolves to empty.","commonSituations":"User selects 'between' for the received-date condition but never fills in the begin date; a variable like ${START_DATE} is used but not defined in the runtime environment (kitchen/pan without the -param or variable set); XML/kjb metadata migrated from another environment with an empty field.","solutions":["Open the job entry dialog and enter a begin date in the 'First date' field (format matching the entry's date format, e.g. yyyy/MM/dd HH:mm:ss).","If a variable is used, define it at runtime (kettle.properties, -param:START_DATE=..., or Set Variables entry) so it resolves non-empty.","Change the condition on received date from 'between' to a single-date condition (equal/greater/smaller) or 'not between' if only one bound is meaningful."],"exampleFix":"// before (kjb XML metadata)\n<received_date_1></received_date_1>\n// after\n<received_date_1>2024/01/01 00:00:00</received_date_1>","handlingStrategy":"validation","validationCode":"String begin = environmentSubstitute(getReceivedDate1());\nif (getConditionOnReceivedDate() == MailConnectionMeta.CONDITION_DATE_BETWEEN\n    && (begin == null || begin.trim().isEmpty())) {\n  throw new IllegalArgumentException(\"Received-date 'between' requires a non-empty begin date\");\n}","typeGuard":null,"tryCatchPattern":"try { executeJobEntry(); } catch (KettleException e) {\n  if (e.getMessage().contains(\"ReceivedDatesSearchTermEmpty\")) {\n    logError(\"Begin/End received date is empty; fix the job entry or define the variable\");\n  } else { throw e; }\n}","preventionTips":["Always fill both date fields when the condition is 'between'.","Avoid variables in date fields unless they are guaranteed set in every runtime (kitchen, CI, prod).","Validate the saved kjb in a smoke test job before scheduling."],"tags":["kettle","email","configuration","empty-field","imap","pop3"],"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"}