{"record":{"id":"3ddc3c4ecef6ce72","repo":"pentaho/pentaho-kettle","slug":"locale-sarg3-is-not-2-characters-long-3ddc3c","errorCode":null,"errorMessage":"Locale {sArg3} is not 2 characters long.","messagePattern":"Locale (.+?) is not 2 characters long\\.","errorType":"exception","errorClass":"JavaScriptException","httpStatus":null,"severity":"error","filePath":"engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java","lineNumber":1074,"sourceCode":"        }\n        break;\n      case 3:\n        try {\n          if ( isNull( ArgList, new int[] { 0, 1, 2 } ) ) {\n            return null;\n          } else if ( isUndefined( ArgList, new int[] { 0, 1, 2 } ) ) {\n            return Context.getUndefinedValue();\n          }\n          sArg1 = Context.toString( ArgList[0] );\n          Format dfFormatter;\n          sArg2 = Context.toString( ArgList[1] );\n          sArg3 = Context.toString( ArgList[2] );\n          if ( sArg3.length() == 2 ) {\n            Locale dfLocale = EnvUtil.createLocale( sArg3 );\n            dfFormatter = new SimpleDateFormat( sArg2, dfLocale );\n            oRC = dfFormatter.parseObject( sArg1 );\n          } else {\n            throw Context.reportRuntimeError( \"Locale \" + sArg3 + \" is not 2 characters long.\" );\n          }\n        } catch ( Exception e ) {\n          throw Context\n            .reportRuntimeError( \"Could not apply the local format for locale \"\n              + sArg3 + \" with the given format \" + sArg2 + \" on the string for \" + sArg1 + \" : \"\n              + e.getMessage() );\n        }\n        break;\n      case 4:\n        try {\n          if ( isNull( ArgList, new int[] { 0, 1, 2, 3 } ) ) {\n            return null;\n          } else if ( isUndefined( ArgList, new int[] { 0, 1, 2, 3 } ) ) {\n            return Context.getUndefinedValue();\n          }\n          sArg1 = Context.toString( ArgList[0] );\n          DateFormat dfFormatter;\n          sArg2 = Context.toString( ArgList[1] );","sourceCodeStart":1056,"sourceCodeEnd":1092,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java#L1056-L1092","documentation":"Locale validation in the 3-argument branch of str2date: the third argument (locale code) is not exactly two characters, so EnvUtil.createLocale cannot build a Locale for it. This guard fires before the formatter is constructed.","triggerScenarios":"Thrown at engine/src/main/java/org/pentaho/di/trans/steps/scriptvalues_mod/ScriptValuesAddedFunctions.java:1074 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an ISO 639 two-letter language code such as \"en\", \"de\", or \"fr\" as the third argument","Drop the locale argument to fall back to the default locale"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}