{"record":{"id":"af5ef5472229d8dc","repo":"pentaho/pentaho-kettle","slug":"jobgetmailsfrompop-error-receiveddatesearchtermempty","errorCode":"JobGetMailsFromPOP.Error.ReceivedDateSearchTermEmpty","errorMessage":"JobGetMailsFromPOP.Error.ReceivedDateSearchTermEmpty","messagePattern":"JobGetMailsFromPOP\\.Error\\.ReceivedDateSearchTermEmpty","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":1090,"sourceCode":"      if ( getProtocol().equals( MailConnectionMeta.PROTOCOL_STRING_IMAP )\n        && ( getActionType() == MailConnectionMeta.ACTION_TYPE_MOVE )\n        || ( getActionType() == MailConnectionMeta.ACTION_TYPE_GET\n        && getAfterGetIMAP() == MailConnectionMeta.AFTER_GET_IMAP_MOVE ) ) {\n        if ( Utils.isEmpty( realMoveToIMAPFolder ) ) {\n          throw new KettleException( BaseMessages.getString( PKG, \"JobGetMailsFromPOP.Error.MoveToIMAPFolderEmpty\" ) );\n        }\n        moveAfter = true;\n      }\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;","sourceCodeStart":1072,"sourceCodeEnd":1108,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/plugins/email-messages/impl/src/main/java/org/pentaho/di/job/entries/getpop/JobEntryGetPOP.java#L1072-L1108","documentation":"In JobEntryGetPOP.execute(), when the condition on the received date is EQUAL, GREATER, or SMALLER, the environment-substituted ReceivedDate1 is validated; if empty, a KettleException keyed 'JobGetMailsFromPOP.Error.ReceivedDateSearchTermEmpty' is thrown before SimpleDateFormat.parse is attempted. A date search term requires a concrete date value.","triggerScenarios":"JobEntryGetPOP (public execute) with getConditionOnReceivedDate() in {EQUAL, GREATER, SMALLER} and the substituted getReceivedDate1() being null/blank.","commonSituations":"User chose a date condition (e.g. 'greater than') but left the date field blank; a variable like ${MAIL_START_DATE} is undefined so substitution produces an empty string.","solutions":["Enter a date in the 'Received Date 1' field in the format the entry expects (e.g. yyyy/MM/dd HH:mm:ss)","If using a variable, ensure it is defined (kettle.properties or a Set Variables entry) and non-empty","Switch the date condition to 'between' only when both dates will be provided"],"exampleFix":"// before\n<received_date_1>${START_DATE}</received_date_1> <!-- unset -->\n// after\n// kettle.properties: START_DATE=2024/01/01 00:00:00\n<received_date_1>2024/01/01 00:00:00</received_date_1>","handlingStrategy":"validation","validationCode":"// before executing, mirror the entry's check:\nString d = receivedDate1 == null ? null : receivedDate1.replaceAll(\"\\\\$\\\\{[^}]+\\\\}\", \"\");\nif (condition != null && !\"between\".equalsIgnoreCase(condition) && (d == null || d.trim().isEmpty())) {\n  throw new IllegalArgumentException(\"ReceivedDate1 required for condition \" + condition);\n}","typeGuard":null,"tryCatchPattern":"try { result = jobEntry.execute(prevResult, ...); } catch (KettleException e) {\n  if (e.getMessage() != null && e.getMessage().contains(\"ReceivedDateSearchTermEmpty\")) {\n    log.error(\"Provide a date for the received-date condition (or clear the condition)\");\n  }\n}","preventionTips":["Fill in 'Received Date 1' whenever a date condition other than none/between is chosen","Confirm date variables are set before the job entry runs","Use a consistent date format matching the entry's parser (e.g. yyyy/MM/dd HH:mm:ss)"],"tags":["kettle","mail","validation","date-filter"],"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"}