{"record":{"id":"8ab9e2777e21e2cf","repo":"apache/druid","slug":"does-not-accept-arguments","errorCode":null,"errorMessage":"does not accept arguments","messagePattern":"does not accept arguments","errorType":"validation","errorClass":"ExpressionValidationException","httpStatus":400,"severity":"error","filePath":"processing/src/main/java/org/apache/druid/math/expr/NamedFunction.java","lineNumber":71,"sourceCode":"\n  default ExpressionProcessingException processingFailed(String reasonFormat, Object... args)\n  {\n    throw new ExpressionProcessingException(this, reasonFormat, args);\n  }\n\n  default ExpressionProcessingException processingFailed(Throwable e, String reasonFormat, Object... args)\n  {\n    throw new ExpressionProcessingException(this, e, reasonFormat, args);\n  }\n\n  /**\n   * Helper method for implementors performing validation to check if the argument count is expected\n   */\n  default void validationHelperCheckArgumentCount(List<Expr> args, int count)\n  {\n    if (args.size() != count) {\n      if (count == 0) {\n        throw validationFailed(\"does not accept arguments\");\n      } else if (count == 1) {\n        throw validationFailed(\"requires 1 argument\");\n      }\n      throw validationFailed(\"requires %d arguments\", count);\n    }\n  }\n\n  /**\n   * Helper method for implementors performing validation to check if there are at least as many arguments as specified\n   */\n  default void validationHelperCheckMinArgumentCount(List<Expr> args, int count)\n  {\n    if (args.size() < count) {\n      if (count == 1) {\n        throw validationFailed(\"requires at least 1 argument\");\n      }\n      throw validationFailed(\"requires at least %d arguments\", count);\n    }","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/apache/druid/blob/9b90983fd291f26935af934383ce360473179e4d/processing/src/main/java/org/apache/druid/math/expr/NamedFunction.java#L53-L89","documentation":"Generic Druid expression validation raised by validationHelperCheckArgumentCount: a function declared to take exactly 0 arguments (count == 0) was invoked with one or more arguments. The function family (e.g. zero-arg builtins like CURRENT_TIMESTAMP-style functions) never accepts parameters, so any supplied arguments cause this validation failure.","triggerScenarios":"Calling a zero-argument named function with arguments, e.g. zerofn('x') or zerofn(col), including accidental argument passing from generic query builders or macro expansion.","commonSituations":"Copy-paste from another SQL dialect where the same-name function takes parameters; template-generated SQL appending unused arguments; confusion between a zero-arg function and a similarly named parameterized one.","solutions":["Remove all arguments: call the function with empty parentheses, e.g. fn().","Check the function name — you may want a different, parameterized function.","If arguments were added by a query builder/template, fix the template for this function.","Consult the Druid expression function reference for the correct arity."],"exampleFix":"// before\nsome_zero_arg_fn('extra')\n// after\nsome_zero_arg_fn()","handlingStrategy":"validation","validationCode":"// check arity before invoking\nif (argCount > 0 && functionTakesZeroArgs(name)) throw new IllegalArgumentException(name + \"() takes no arguments\");","typeGuard":"// reject any non-empty argument list for zero-arg functions\nif (args.length !== 0) reject();","tryCatchPattern":null,"preventionTips":["Call zero-arg functions with empty parentheses","Verify function arity in the Druid expression docs","Audit query-builder templates for stray arguments"],"tags":["druid","expressions","argument-count","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"9b90983fd291f26935af934383ce360473179e4d","analyzedAt":"2026-09-07T13:32:30.957Z","contentChangedAt":"2026-09-07T13:32:30.957Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}