WTH Why do I get warnings in my log when changing the input select options?

Using the input_select.set_options action I change my options but get a warning if the new options don’t contain the currently selected option. Seems normal because I just changed the options so why the warning? Why not just select the first option in the list when the options are changed?

I see this was raised a few years ago but didn’t get a response? Dynamic options for input_select keep throwing warnings on 'no longer valid' · Issue #65669 · home-assistant/core · GitHub

Maybe because the devs do not know if the first option is “safe” to be selected.
Remember the devs needs to take all the possible situations into account, not just yours.

1 Like

You can filter that warning out from your logs. I doubt this warning will go away because if you use the service call via yaml, you can type anything in for the option.

That’s what I am doing. I am generating a dynamic list of media players via a template in yaml depending on another selection. I want to share this but I end up with 100s of these warnings because the dependent selection can be changed often.

Yes but what you aren’t understanding is that the warning is valuable if you miss-use the service call. I.e. other people will get use out of it when they debug faulty automations. This is why it’s a warning. It’s not an error but it should be altered to the user.

Fair enough just seems odd that I am getting a warning thrown when I feel I am using the action as designed?

I would suggest that you aren’t. If the current selection isn’t in the list that you’ve generated then you should be creating an item that exists in all your lists that can be carried over when altering the options.

e.g. A “no option” option that’s the first item in your dynamic list.

I currently manage a dynamic option list and I always just add or remove from my current list. I don’t wipe out the entire thing.

One could argue that if you completely change all options that it defaults to no selection. That might be a good WTH but it would probably be considered a breaking change

I did think of that but it isn’t possible as this is a list of media player friendly names and most sets of those are mutually exclusive of the others.

edit: also having the common option will only work if that was the selected option at the point the list was changed. I guess you could do a hacky solution to ensure that…but not ideal…