phalcon/cphalcon · error · Phalcon\ADR\Exceptions\RouteNotFound
No route matched the request.
Error message
No route matched the request.
What it means
QueryBuilderCursor requires a 'builder' config entry. The check uses fetch, so it fails both when the key is absent and when its value is null — MissingRequiredParameter('builder') is thrown at construction. The builder is the Phalcon\Mvc\Model\Query\Builder whose query the paginator slices with keyset conditions.
Source
Thrown at phalcon/ADR/Router/AttributeFilter.zep:68
if !method_exists(actionClass, "params") {
return attributes;
}
let params = call_user_func([actionClass, "params"]);
if typeof params !== "array" {
return attributes;
}
for name, rule in params {
if isset attributes[index] {
let segment = attributes[index];
if isset rule["match"] {
let pattern = rule["match"];
if !preg_match("#^(?:" . pattern . ")$#", segment) {
throw new RouteNotFound();
}
}
let type = isset rule["type"] ? rule["type"] : "string",
value = this->cast(segment, type);
if isset rule["convert"] {
let convert = rule["convert"],
value = call_user_func(convert, value);
}
let result[name] = value;
}
let index++;
}
for key, item in attributes {View on GitHub (pinned to b7419de9cd)
Solutions
- Pass the builder under the exact 'builder' key: 'builder' => $builder.
- Ensure the variable actually holds a builder — create it with $modelsManager->createBuilder() or new Builder([...]) before constructing the paginator.
- If the builder comes from DI/factory code, verify that code path returns a Builder and not null.
Example fix
// before
$builder = $service->maybeGetBuilder(); // returns null when filters are empty
$paginator = new QueryBuilderCursor(
[
'limit' => 20,
'builder' => $builder,
'cursorColumn' => 'id',
]
); // throws MissingRequiredParameter('builder')
// after
$builder = $modelsManager->createBuilder()->from(Orders::class);
$paginator = new QueryBuilderCursor(
[
'limit' => 20,
'builder' => $builder,
'cursorColumn' => 'id',
]
); Defensive patterns
Strategy: validation
Validate before calling
if (!array_key_exists('builder', $config) || $config['builder'] === null) {
throw new \InvalidArgumentException(
'QueryBuilderCursor requires a non-null \'builder\' entry'
);
}
// remember: the constructor uses fetch, so null is treated as missing too Prevention
- Never pass a possibly-null builder variable; construct a default builder explicitly.
- Assert the builder was actually created in DI/factory code before building the paginator.
When it happens
Trigger: new QueryBuilderCursor(['limit' => 20, 'cursorColumn' => 'id']) with no 'builder' key, or 'builder' => null (e.g. a variable that was never initialized).
Common situations: Conditionally created builders (null when a filter branch is skipped); copying config from examples that omit the builder; DI wiring that injects the builder under a different key name.
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- Headers have already been sent; cannot emit the response.
- The request method is not allowed for the matched route.
- Invalid value for the accessList
- No action directory set; call setActionDirectory().
- Role '{roleName}' (to inherit) does not exist in the role li
AI-assisted analysis of phalcon/cphalcon@b7419de9cd (2026-08-21).
Data as JSON: /api/errors/408065b4e1a9ac1e.
Report an issue: GitHub.