{"record":{"id":"81624414097561bb","repo":"apple/pkl","slug":"methodnotdefined5","errorCode":"methodNotDefined5","errorMessage":"methodNotDefined5","messagePattern":"methodNotDefined5","errorType":"error_code","errorClass":"VmException","httpStatus":null,"severity":"error","filePath":"pkl-core/src/main/java/org/pkl/core/stdlib/ExternalMethod5Node.java","lineNumber":49,"sourceCode":"\n  protected abstract ExpressionNode getArg2Node();\n\n  protected abstract ExpressionNode getArg3Node();\n\n  protected abstract ExpressionNode getArg4Node();\n\n  protected abstract ExpressionNode getArg5Node();\n\n  @Fallback\n  @TruffleBoundary\n  protected Object fallback(\n      @SuppressWarnings(\"unused\") Object receiver,\n      Object arg1,\n      Object arg2,\n      Object arg3,\n      Object arg4,\n      Object arg5) {\n    throw exceptionBuilder()\n        .evalError(\n            \"methodNotDefined5\",\n            getQualifiedMemberName(),\n            VmUtils.getClass(arg1),\n            VmUtils.getClass(arg2),\n            VmUtils.getClass(arg3),\n            VmUtils.getClass(arg4),\n            VmUtils.getClass(arg5))\n        .withProgramValue(\"Argument 1\", arg1)\n        .withProgramValue(\"Argument 2\", arg2)\n        .withProgramValue(\"Argument 3\", arg3)\n        .withProgramValue(\"Argument 4\", arg4)\n        .withProgramValue(\"Argument 5\", arg5)\n        .build();\n  }\n\n  public interface Factory {\n    ExternalMethod5Node create(","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/apple/pkl/blob/f3efcbfc9b60d30053b0536d664948d7aa1b8673/pkl-core/src/main/java/org/pkl/core/stdlib/ExternalMethod5Node.java#L31-L67","documentation":"ExternalMethod5Node implements five-argument stdlib methods. If dispatch cannot match the receiver and all five argument types to any defined node, the @Fallback throws \"methodNotDefined5\" with the method name and the class of each of the five arguments. This is the largest-arity variant of Pkl's method-not-defined family.","triggerScenarios":"Calling a five-argument stdlib method where at least one argument's dynamic type matches no overload — e.g. a null from an optional property or a List passed where a Function/predicate is required.","commonSituations":"Deeply positional calls where an argument is silently omitted or shifted; refactors changing a parameter's type without updating all call sites; interop values (YAML/JSON) arriving as different Pkl types than assumed.","solutions":["Compare every reported argument class to the documented parameter types.","Normalize interop data (YAML/JSON) explicitly — convert Numbers/Strings to the expected Pkl types before the call.","Refactor the call into named intermediate values so each argument's type is visible and testable.","Confirm the overload exists in the Pkl version in use; upgrade or adjust the call accordingly."],"exampleFix":"// before\npairs.map(values, keys, transform, /* filter */ null, /* limit */ \"10\")\n// after\npairs.map(values, keys, transform, null, 10) // Int limit","handlingStrategy":"type-guard","validationCode":"// Pkl\nassert(args.every((a) -> a != null), \"no argument may be null here\")","typeGuard":"function isNonNull(x) = x != null\n// combine with per-slot checks: a is Int, b is String, ...","tryCatchPattern":null,"preventionTips":["Normalize YAML/JSON interop data to expected Pkl types before calls","Prefer records/objects over long positional argument lists","Update all call sites when a stdlib signature changes across versions"],"tags":["pkl","type-mismatch","method-resolution"],"backgroundTag":"invalid-argument-value","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"}