This appears to be a bug where it won't recognize the include file is on the page when it is contained inside the same code chunk.
The solution is to add the :
?>
<?php
in between the require_once and the rest of the script. We'll log this as a bug to either make sure we always add the include in a separate code chunk or recognize it when it isn't and try to get it resolved sometime soon.