phacility/phabricator · error · Exception
Function " " expects argument(s), but argument(s) were…
Error message
Function "%s" expects %s argument(s), but %s argument(s) were provided.
What it means
PhabricatorChartFunctionArgumentParser::parseArguments() enforces an exact argument count when no argument is repeatable: the number of raw arguments must equal the number of declared arguments. Any mismatch throws this Exception with the signature, expected count, and provided count.
Solutions
- Match the count exactly — the message states how many arguments the function expects.
- Trim or fill the argument list before construction based on the function's newArguments() declaration.
- Validate counts per function name when building specs from user input.
- Update stored specs after function signatures change between versions.
Example fix
// before
$fn = array('constant'); // 'constant' expects exactly 1 argument -> Exception
// after
$fn = array('constant', 1); Defensive patterns
Strategy: validation
Validate before calling
$expected = count($function->newArguments());
if (count($raw_arguments) !== $expected) {
throw new Exception(
sprintf('Expected %d arguments, got %d', $expected, count($raw_arguments)));
} Prevention
- Match fixed-arity functions exactly — no extra, no missing arguments.
- After version upgrades, review chart function signatures your specs depend on.
- Log the raw argument list alongside parse errors when specs come from users.
When it happens
Trigger: Invoking a fixed-arity chart function (e.g. one declared argument like 'constant') with a different number of arguments — zero, or two-plus — via a dictionary argument list or direct parser use.
Common situations: Extra arguments silently appended by dynamic list building; missing arguments from unset parameters; specs written against an older signature; treating fixed-arity functions as variadic.
Related errors
- Function " " expects at least argument(s), but only…
- Function " " expects or more argument(s), but only…
- Argument " " (in position " ") to function " " is invalid
- Attempting to build function
- Chart uses unknown engine key
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/28fc9cd1c9f09bb2.
Report an issue: GitHub.
Appendix: source
Thrown at src/applications/fact/chart/PhabricatorChartFunctionArgumentParser.php:127
}
public function parseArguments() {
$have_count = count($this->rawArguments);
$want_count = count($this->argumentMap);
if ($this->haveAllArguments) {
if ($this->repeatableArgument) {
if ($want_count > $have_count) {
throw new Exception(
pht(
'Function "%s" expects %s or more argument(s), but only %s '.
'argument(s) were provided.',
$this->getFunctionArgumentSignature(),
$want_count,
$have_count));
}
} else if ($want_count !== $have_count) {
throw new Exception(
pht(
'Function "%s" expects %s argument(s), but %s argument(s) were '.
'provided.',
$this->getFunctionArgumentSignature(),
$want_count,
$have_count));
}
}
while ($this->unparsedArguments) {
$argument = array_shift($this->unparsedArguments);
$name = $argument->getName();
if (!$this->unconsumedArguments) {
throw new Exception(
pht(
'Function "%s" expects at least %s argument(s), but only %s '.
'argument(s) were provided.',View on GitHub (pinned to 5720a38cfe)