Is it illegal to have a flask in your car?

In California, it is illegal to have any “open” container of alcohol in your vehicle. This is true regardless of whether you are drinking it and even if there is no longer any alcohol in the container.