flarum/framework · error · BadRequestException
Invalid includes [
Error message
Invalid includes [
What it means
Thrown in RequestUtil::extractInclude after splitting the include parameter: any requested relationship path not present in the endpoint's available-includes list is rejected with 400 to prevent arbitrary relationship eager loading. The message lists the offending comma-separated include paths (the recorded text is truncated; the full message is 'Invalid includes [<paths>]').
Solutions
- Only request include paths the endpoint documents as includable
- Remove unsupported includes from the query string
- If server-side is yours, allow the relationship via the endpoint's include registration
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at framework/core/src/Http/RequestUtil.php:216 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of flarum/framework@4b939f6853 (2026-09-15).
Data as JSON: /api/errors/9c047859afd93272.
Report an issue: GitHub.
Appendix: source
Thrown at framework/core/src/Http/RequestUtil.php:216
}
return $offset;
}
public static function extractInclude(Request $request, ?array $available): array
{
$include = $request->getQueryParams()['include'] ?? '';
if (! is_string($include)) {
throw new BadRequestException('include must be a string');
}
$includes = array_filter(explode(',', $include));
$invalid = array_diff($includes, $available);
if (count($invalid)) {
throw new BadRequestException('Invalid includes ['.implode(',', $invalid).']');
}
return $includes;
}
public static function extractFilter(Request $request): array
{
$filter = $request->getQueryParams()['filter'] ?? [];
if (! is_array($filter)) {
throw new BadRequestException('filter must be an array');
}
return $filter;
}
public static function extractFields(Request $request, ?array $available = null): array
{View on GitHub (pinned to 4b939f6853)