{"record":{"id":"2cb1a1a789793200","repo":"pentaho/pentaho-kettle","slug":"function-decode-can-t-have-arguments","errorCode":null,"errorMessage":"Function DECODE can't have  arguments!","messagePattern":"Function DECODE can't have  arguments!","errorType":"exception","errorClass":"KettleValueException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/compatibility/Value.java","lineNumber":3333,"sourceCode":"\n    // Limit to 3, 5, 7, 9, ... arguments\n\n    if ( args.length >= 3 && ( args.length % 2 ) == 1 ) {\n      i = 0;\n      found = false;\n      while ( i < args.length - 1 && !found ) {\n        if ( this.equals( args[i] ) ) {\n          setValue( args[i + 1] );\n          found = true;\n        }\n        i += 2;\n      }\n      if ( !found ) {\n        setValue( args[args.length - 1] );\n      }\n    } else {\n      // ERROR with nr of arguments\n      throw new KettleValueException( \"Function DECODE can't have \" + args.length + \" arguments!\" );\n    }\n\n    return this;\n  }\n\n  // implement the IF function, arguments in args[]\n  // IF( <condition>, <then value>, <else value>)\n  public Value v_if( Value[] args ) throws KettleValueException {\n    if ( getType() == VALUE_TYPE_BOOLEAN ) {\n      if ( args.length == 1 ) {\n        if ( getBoolean() ) {\n          setValue( args[0] );\n        } else {\n          setNull();\n        }\n      } else if ( args.length == 2 ) {\n        if ( getBoolean() ) {\n          setValue( args[0] );","sourceCodeStart":3315,"sourceCodeEnd":3351,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/compatibility/Value.java#L3315-L3351","documentation":"Validation of the DECODE function's argument list: it requires an odd count of at least 3 arguments (search/result pairs plus a default). The actual args.length, interpolated into the message, is even or below 3, so the if/else ladder of the legacy Value decode() cannot be evaluated.","triggerScenarios":"Thrown at core/src/main/java/org/pentaho/di/compatibility/Value.java:3333 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an odd number (3, 5, 7, ...) of arguments to DECODE: pairs of search/value plus a final default","Remove or add arguments so args.length % 2 == 1 and args.length >= 3"],"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"}