Hugo server preferring configured theme over command line

Running HUGO_THEME="mytheme" hugo server, while having theme: myothertheme in the config, does something weird. The home page is rendered from myothertheme, but when I click on any of the posts, I get 404 page not found – because mytheme is just a stub now with no templates.