[2.x] A filter on a resource without a searcher returns a 500
Maintainers usually reply within 1 day
@imorland is already working on this.
Since Nov 23, 2026.
Assessment
This issue has not been assessed yet.
Description
Current Behavior
Any filter[...] on a list endpoint whose resource has no searcher returns a 500:
RuntimeException: Not supported in Flarum, please use a model searcher instead https://docs.flarum.org/extend/search.
Api\Endpoint\Index uses the search manager only for searchable models. For other resources it calls applyFilters(), which calls AbstractDatabaseResource::filters(), and that method always throws. A client mistake therefore surfaces as a server error. This happens on every database driver.
Steps to Reproduce
- Enable
flarum/flags(itsflagsresource has no searcher). - As an admin, request
GET /api/flags?filter[id]=1. - The response is a 500 with the exception above.
Expected Behavior
A 400, as json-api-server's apply_filters() gives for a filter a resource doesn't define (Invalid filter: <name>).
Environment
- Flarum:
2.x@ b43a84be3 - Reproduced on PostgreSQL 18; the code path doesn't depend on the driver.
Possible Solution
In Index, when the model isn't searchable and the request has filters, throw the same BadRequestException instead of reaching filters().
- Dominant language
- PHP
- Stars
- 6.8k
- Forks
- 891
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 209
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from flarum/framework
-
type/accessibility type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
Default language is ignored for anyone who chose a language, when the language selector is hiddenPossibly taken @1AbdullahButt claimed this 15 days ago. Opentype/bug
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
Maintainers usually reply within 1 day
-
[2.x] False CLI/Web PHP mismatch when /usr/bin/php differs from the site's FPMPossibly taken @lazerg claimed this 15 days ago. Opentype/bug
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
[2.x] Audit's discussion and user filters fail on PostgreSQLPossibly taken @imorland claimed this today. Opentype/bug
flarum/framework#5577 · 1 assignee ·
Maintainers usually reply within 1 day
All issues in flarum/framework
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 87/100
Sylius/Sylius#19359 · 1 comment ·
Maintainers usually reply within 1 day
-
Add php 8.6Open
Difficulty 1/5 Under an hour Newbie friendliness 66/100
mailersend/mailersend-php#199 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
Configuration new tool
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
novalo-dev/Prestashop-MCP-Server#366 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 10 days