This sends a command to the server to ask for the current list of non-private channels, so this should work unless you're not actually connected to a server, or you're connected to a network that doesn't support LIST, or if you have a scripted alias that intercepts the LIST command and does something else instead, or if you have a script that intercepts the server's reply to the LIST command and does something else with it.

You can make sure you don't have a script messing with it by temporarily disabling remote events to see if it starts working, by pasting this command into the status window:

//remote OFF | raw LIST

... and after testing, be sure to turn remote back on: /remote ON