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:
Adding ->whereNotNull() to my query fetching the Select option did the trick
Jump to solution
17 Replies
awcodes
awcodes14mo ago
Can you show us some code.? Or at least a flair url.
Hooligan Dev
Hooligan DevOP14mo ago
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
awcodes
awcodes14mo ago
At the top of the exception there should be a “share” link.
Hooligan Dev
Hooligan DevOP14mo ago
oh, let me look at it
Hooligan Dev
Hooligan DevOP14mo ago
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
awcodes
awcodes14mo ago
according to that error you aren't passing a label as the second parameter to ->isOptionDisabled()
Hooligan Dev
Hooligan DevOP14mo ago
isOptionDisabled is not anywhere in my code it must be something internal?
awcodes
awcodes14mo ago
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
Hooligan Dev
Hooligan DevOP14mo ago
This is very hard to debug. Error trace doesnt help much Okay I got something. It looks like is coming from a SelectFilter
Hooligan Dev
Hooligan DevOP14mo ago
There we go
No description
Hooligan Dev
Hooligan DevOP14mo ago
Database is returning an empty record Fixed!
Solution
Hooligan Dev
Hooligan Dev14mo ago
Adding ->whereNotNull() to my query fetching the Select option did the trick
Hooligan Dev
Hooligan DevOP14mo ago
Thank you so much @awcodes
Son of Andy
Son of Andy14mo ago
@Javier M im having the same issue when using the select
No description
corean
corean14mo ago
maybe, value is null in <select>
awcodes
awcodes14mo ago
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.
cheesegrits
cheesegrits14mo ago
And you also need to make sure whatever your 'name' field is, isn't null.
Want results from more Discord servers?
Add your server