{"record":{"id":"12a26a88af2e4869","repo":"pentaho/pentaho-kettle","slug":"dimensionlookup-exception-illegalstartdateselection","errorCode":null,"errorMessage":"DimensionLookup.Exception.IllegalStartDateSelection","messagePattern":"DimensionLookup\\.Exception\\.IllegalStartDateSelection","errorType":"exception","errorClass":"KettleStepException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookup.java","lineNumber":1129,"sourceCode":"        break;\n      case DimensionLookupMeta.START_DATE_ALTERNATIVE_SYSDATE:\n        // use the time the step execution begins as the date from (passed in as dateFrom).\n        // before, the current system time was used. this caused an exclusion of the row in the\n        // lookup portion of the step that uses this 'valueDate' and not the current time.\n        // the result was multiple inserts for what should have been 1 [PDI-4317]\n        insertRow[ insertIndex++ ] = dateFrom;\n        break;\n      case DimensionLookupMeta.START_DATE_ALTERNATIVE_START_OF_TRANS:\n        insertRow[ insertIndex++ ] = getTrans().getStartDate();\n        break;\n      case DimensionLookupMeta.START_DATE_ALTERNATIVE_NULL:\n        insertRow[ insertIndex++ ] = null;\n        break;\n      case DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE:\n        insertRow[ insertIndex++ ] = inputRowMeta.getDate( row, data.startDateFieldIndex );\n        break;\n      default:\n        throw new KettleStepException( BaseMessages.getString(\n          PKG, \"DimensionLookup.Exception.IllegalStartDateSelection\", Integer.toString( data.startDateChoice ) ) );\n    }\n\n    insertRow[ insertIndex++ ] = dateTo;\n\n    for ( int i = 0; i < data.keynrs.length; i++ ) {\n      insertRow[ insertIndex++ ] = row[ data.keynrs[ i ] ];\n    }\n    for ( int i = 0; i < data.fieldnrs.length; i++ ) {\n      if ( data.fieldnrs[ i ] >= 0 ) {\n        // Ignore last_version, last_updated, etc. These are handled below...\n        //\n        insertRow[ insertIndex++ ] = row[ data.fieldnrs[ i ] ];\n      }\n    }\n    // The special update fields...\n    //\n    for ( int i = 0; i < meta.getFieldUpdate().length; i++ ) {","sourceCodeStart":1111,"sourceCodeEnd":1147,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/dimensionlookup/DimensionLookup.java#L1111-L1147","documentation":"The step's configured 'date range start' selection is a value that doesn't correspond to any known start-date alternative (system date, null, column value, etc.). In dimInsert, the switch over data.startDateChoice hits default and throws a KettleStepException with the numeric choice code, indicating corrupted/unknown metadata rather than a data problem.","triggerScenarios":"dimInsert writes the startDate into the insert row; if data.startDateChoice holds a value outside the DimensionLookupMeta.START_DATE_ALTERNATIVE_* constants, the switch falls to default.","commonSituations":"Hand-edited transformation XML (ktr) with an out-of-range value for the start-date alternative; forward-compatibility issue opening a transformation saved by a newer Pentaho version with new enum values; plugin version mismatch.","solutions":["Reopen the transformation in the Spoon GUI and reselect the 'Date range start' option so the metadata is rewritten","Open the .ktr XML and fix/inspect the start-date alternative attribute to a valid value","Upgrade Pentaho Data Integration so newer enum values from a newer file version are understood","If programmatic metadata is used, set DimensionLookupMeta.startDateAlternative to a valid START_DATE_ALTERNATIVE_* constant"],"exampleFix":"// before (ktr XML)\n// <start_date_alternative>9</start_date_alternative>\n// after\n// <start_date_alternative>1</start_date_alternative>  <!-- valid: system date -->\n// (or re-select 'System date' in the dialog and save)","handlingStrategy":"validation","validationCode":"// programmatic metadata: validate the choice before use\nif (startDateChoice != DimensionLookupMeta.startDateAlternativeNone\n && startDateChoice != DimensionLookupMeta.startDateAlternativeSystemDate\n && startDateChoice != DimensionLookupMeta.startDateAlternativeNull\n && startDateChoice != DimensionLookupMeta.startDateAlternativeColumnValue) {\n  throw new IllegalStateException(\"Illegal start date alternative: \" + startDateChoice);\n}","typeGuard":"boolean isValidStartDateChoice(int choice) {\n  return choice >= DimensionLookupMeta.START_DATE_ALTERNATIVE_NONE\n      && choice <= DimensionLookupMeta.START_DATE_ALTERNATIVE_COLUMN_VALUE;\n}","tryCatchPattern":"try {\n  dimInsert(rowMeta, row);\n} catch (KettleStepException e) {\n  if (e.getMessage().contains(\"IllegalStartDateSelection\")) {\n    logError(\"Corrupt start-date metadata; reselect in dialog\");\n  } else { throw e; }\n}","preventionTips":["Don't hand-edit .ktr XML values for enums; change options via the Spoon GUI","Match PDI version when opening transformations saved by newer releases","When building meta programmatically, only use published constants"],"tags":["etl","metadata","invalid-enum","slowly-changing-dimension"],"backgroundTag":"invalid-enum-value","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"}