apple/pkl · error · VmException
methodNotDefined5
methodNotDefined5
Error message
methodNotDefined5
What it means
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.
Source
Thrown at pkl-core/src/main/java/org/pkl/core/stdlib/ExternalMethod5Node.java:49
protected abstract ExpressionNode getArg2Node();
protected abstract ExpressionNode getArg3Node();
protected abstract ExpressionNode getArg4Node();
protected abstract ExpressionNode getArg5Node();
@Fallback
@TruffleBoundary
protected Object fallback(
@SuppressWarnings("unused") Object receiver,
Object arg1,
Object arg2,
Object arg3,
Object arg4,
Object arg5) {
throw exceptionBuilder()
.evalError(
"methodNotDefined5",
getQualifiedMemberName(),
VmUtils.getClass(arg1),
VmUtils.getClass(arg2),
VmUtils.getClass(arg3),
VmUtils.getClass(arg4),
VmUtils.getClass(arg5))
.withProgramValue("Argument 1", arg1)
.withProgramValue("Argument 2", arg2)
.withProgramValue("Argument 3", arg3)
.withProgramValue("Argument 4", arg4)
.withProgramValue("Argument 5", arg5)
.build();
}
public interface Factory {
ExternalMethod5Node create(View on GitHub (pinned to f3efcbfc9b)
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.
Example fix
// before pairs.map(values, keys, transform, /* filter */ null, /* limit */ "10") // after pairs.map(values, keys, transform, null, 10) // Int limit
Defensive patterns
Strategy: type-guard
Validate before calling
// Pkl assert(args.every((a) -> a != null), "no argument may be null here")
Type guard
function isNonNull(x) = x != null // combine with per-slot checks: a is Int, b is String, ...
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.
Related errors
- methodNotDefined1
- methodNotDefined2
- methodNotDefined3
- methodNotDefined4
- Error converting property `%s` in Pkl object of type `%s` to
AI-assisted analysis of apple/pkl@f3efcbfc9b (2026-09-08).
Data as JSON: /api/errors/81624414097561bb.
Report an issue: GitHub.