Select::isOptionDisabled(): Argument #2 ($label) must be of type string, null given
After upgrading to Filament 3 I am getting this error on some of my resources. I tried to follow the traces but nothing was clear there. Any idea what changed that made my app break?
Solution:Jump to solution
Adding
->whereNotNull()
to my query fetching the Select option did the trick17 Replies
Can you show us some code.?
Or at least a flair url.
The trace is not precise on where this is happening and I have a lot of code. It is clearly happening in a Select and same code works on v2 branch
If you guide me a bit I can try to find out the cause of the exception
At the top of the exception there should be a “share” link.
oh, let me look at it
Flare
Filament\Forms\Components\Select::isOptionDisabled(): Argument #2 ($label) must be of type string, null given, called in /Users/javiermartinez/Sites/ocert/vendor/filament/forms/src/Components/Select.php on line 180 - The error occurred at https://ocert.test/filament/inputs
according to that error you aren't passing a label as the second parameter to ->isOptionDisabled()
isOptionDisabled
is not anywhere in my code
it must be something internal?that's possible too.
make sure that all of your selects have an actual label, possibly anywhere you are using ->label() on a select
could possibly be in a plugin too. you'll need to update all of those too, assuming they have a compatible v3 version
This is very hard to debug. Error trace doesnt help much
Okay I got something. It looks like is coming from a SelectFilter
There we go
Database is returning an empty record
Fixed!
Solution
Adding
->whereNotNull()
to my query fetching the Select option did the trickThank you so much @awcodes
@Javier M im having the same issue when using the select
maybe, value is null in <select>
You need to pluck the needed attributes from your query and make sure it’s an array of key value pairs.
->pluck(‘name’, ‘id’) for example.
And you also need to make sure whatever your 'name' field is, isn't null.