When I was adding an in-line code into master page I was getting the following error.
An error occurred during the processing of /sites/<collection>/SitePages/Welcome.master. Code blocks are not allowed in this file.
The fix is add the following code to the web.config of the web application which hosts the site collection.
<PageParserPath VirtualPath="/sites/site/_catalogs/masterpage/Welcome.master" CompilationMode="Always" AllowServerSideScript="true">