phalcon/cphalcon · error · Phalcon\Di\Exceptions\MethodCallMustBeArray
Method call must be an array on position
Error message
Method call must be an array on position {position} What it means
Thrown by Builder::build while iterating the 'calls' list: an element at the given position is not an array. Each call must be an array with a 'method' key and optionally 'arguments'. Fix the entry at that position to be an array.
Solutions
- Wrap each call entry in an array: position N must be like {'method': name, 'arguments': [...]}
- Remove malformed entries from the 'calls' list
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at phalcon/Di/Service/Builder.zep:102 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21).
Data as JSON: /api/errors/4886e771b97db1b7.
Report an issue: GitHub.
Appendix: source
Thrown at phalcon/Di/Service/Builder.zep:102
*/
if fetch paramCalls, definition["calls"] {
if unlikely typeof instance !== "object" {
throw new SetterInjectionRequiresInstance();
}
if unlikely typeof paramCalls != "array" {
throw new SetterParametersMustBeArray();
}
/**
* The method call has parameters
*/
for methodPosition, method in paramCalls {
/**
* The call parameter must be an array of arrays
*/
if unlikely typeof method != "array" {
throw new MethodCallMustBeArray(methodPosition);
}
/**
* A param 'method' is required
*/
if unlikely !fetch methodName, method["method"] {
throw new MethodNameRequired(methodPosition);
}
/**
* Create the method call
*/
let methodCall = [instance, methodName];
if fetch arguments, method["arguments"] {
if unlikely typeof arguments != "array" {
throw new CallArgumentsMustBeArray((int) methodPosition);
}View on GitHub (pinned to b7419de9cd)