{"record":{"id":"7b4786ae6cb7ca99","repo":"apple/pkl","slug":"wrongfunctionargumentcount","errorCode":"wrongFunctionArgumentCount","errorMessage":"wrongFunctionArgumentCount","messagePattern":"wrongFunctionArgumentCount","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/ast/type/IdentityMixinNode.java","lineNumber":59,"sourceCode":"    this.argumentTypeNode = argumentTypeNode;\n  }\n\n  @Override\n  public SourceSection getSourceSection() {\n    return sourceSection;\n  }\n\n  @Override\n  public String getName() {\n    return qualifiedName;\n  }\n\n  @Override\n  protected Object executeImpl(VirtualFrame frame) {\n    var arguments = frame.getArguments();\n    if (arguments.length != 3) {\n      CompilerDirectives.transferToInterpreter();\n      throw exceptionBuilder()\n          .evalError(\"wrongFunctionArgumentCount\", 1, arguments.length - 2, \"\")\n          .withSourceSection(sourceSection)\n          .build();\n    }\n    var argument = arguments[2];\n    if (argumentTypeNode != null) {\n      return argumentTypeNode.execute(frame, argument);\n    }\n    return argument;\n  }\n}\n","sourceCodeStart":41,"sourceCodeEnd":71,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/ast/type/IdentityMixinNode.java#L41-L71","documentation":"`wrongFunctionArgumentCount` is thrown by IdentityMixinNode when the generated mixin identity function is invoked with the wrong number of arguments. The node expects a receiver plus exactly 1 argument (frame arguments length 3); any other count is a call-site arity error. The message states the expected count (1) versus the actual count.","triggerScenarios":"Calling a Pkl function that compiles to this mixin identity function with 0 or more than 1 argument, e.g. `foo()` or `foo(a, b)` instead of `foo(a)`.","commonSituations":"Calling a property-like function with parentheses but wrong arity; copy-paste call sites after a signature change; misreading a zero-argument property as a function.","solutions":["Call the function with exactly one argument","Remove extra arguments or supply the missing one at the call site","Check the function's declared parameter list and update all call sites"],"exampleFix":"// before\nmixinIdentity()\n// after\nmixinIdentity(value)","handlingStrategy":"validation","validationCode":"// check arity before invoking\nif (typeof fn === \"function\" && fn.length !== 1) throw new Error(\"expected exactly 1 argument\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Match call-site arguments to the declared parameter count","Re-grep call sites after changing a function signature"],"tags":["pkl","arity","function-call"],"backgroundTag":"missing-required-argument","analyzedSha":"f3efcbfc9b60d30053b0536d664948d7aa1b8673","analyzedAt":"2026-09-08T13:10:45.570Z","contentChangedAt":"2026-09-08T13:10:45.570Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}