function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sheri@SupportPaySheri@SupportPay 

Error: <apex:page> is required and must be the outermost tag in the markup at line 1 column 1

 Everytime I try to save a visualforce page in the setup section I get the following error:Error: <apex:page> is required and must be the outermost tag in the markup at line 1 column 1

I get the error if i edit the page, if i try to rename the file or even if i open it up and just hit save. This is happening on all visualforce pages. Any ideas? My Code: (This is just the standard SFDC Login Visualforce page.
Best Answer chosen by Sheri@SupportPay
Sheri@SupportPaySheri@SupportPay
In case anyone else runs into this issue I figured out it is an issue with Google Chrome. I do not get the issue when i try to update the page in Firefox. The version of Chrome I saw the issue was 33.0.

All Answers

Phillip SouthernPhillip Southern
can you post the code?  are you sure <apex:page at line 1 is followed by /> at the end and also </apex:page> as the last line in the VF page?
Sheri@SupportPaySheri@SupportPay
In case anyone else runs into this issue I figured out it is an issue with Google Chrome. I do not get the issue when i try to update the page in Firefox. The version of Chrome I saw the issue was 33.0.
This was selected as the best answer
Carlos Alberto Villarreal RomoCarlos Alberto Villarreal Romo
I tried with Explorer and did not work.  I am trying to create the following visualforce page with the error on title:
<apex:page standardController=”Opportunity”>
< Zone:Zone
Value=”{!Opportunity.Codigo_Final__c}”
BrcdType=”{!Opportunity.Codigo_Tipo__c}”
BrcdHeight=”40”
rendered=”true”
/>
</apex:page>

What do I need to do differently?
Melissa SautterMelissa Sautter
Hi Carlos, Did you ever get an answer to this? I am getting the same error with a similar visualforce page and it's driving me nuts! I've tried both Chrome and Firefox.
Carlos Alberto Villarreal RomoCarlos Alberto Villarreal Romo

Hello Melissa.  It has been a long time since I solve this.  Here is the code that did work:

<apex:page standardController="Opportunity" showHeader="false">
<BarcodeZone:ACBarcodeZone Value="{!Opportunity.NextStep}" BrcdType="{!Opportunity.Type}" BrcdHeight="40" rendered="true" /> </apex:page>

One of the errors I had had to do with calling a custom field when I had to change to a standard field which I figured I was not using Opportunity.Type.  Try using a standard field.  I hope it works!

And relax, take a break, grab some coffee/tea and remember to breathe :)
Dheeraj UpadhyayDheeraj Upadhyay

Hello Sheri, I am new to visualforce page deveolopment  and  I am also suffering from same error.

If u have resolve out this problem then please help me regarding this issue.

Pankaj BhaTI 8Pankaj BhaTI 8
Hello Sheri, I get find same error of visualforce page- 

Error: <apex:page> is required and must be the outermost tag in the markup at line 1 column 1

You've any solution of this error if u tell me solution of this error then my big problem is solved..
Pankaj BhaTI 8Pankaj BhaTI 8
Hi Carlos,
               Can u solve this error of Visualforce page because I've not solved by me so please it is big problem of my coding then it's not execute this code,Can u solve error of this code

Error: <apex:page> is required and must be the outermost tag in the markup at line 1 column 1

 
  •  It's code of visualforce page.. so error in this code can u execute this code without error

<apex:component controller="SiteLoginController" id="loginComponent">
    <apex:form id="loginForm" forceSSL="true">
        <apex:outputPanel layout="block">
            <apex:pageMessages id="error" />
            <apex:panelGrid columns="2" style="margin-top:1em;">             
                <apex:outputLabel value="{!$Label.site.username}" for="username" />
                <apex:inputText id="username" value="{!username}" />
                <apex:outputLabel value="{!$Label.site.password}" for="password" />
                <apex:inputSecret id="password" value="{!password}" />             
                <br />
                <apex:commandButton action="{!login}"
                    value="{!$Label.site.login_button}" id="loginButton" />
                <br />
                <apex:panelGroup id="theLinks">                     
                    <apex:outputLink value="{!$Page.ForgotPassword}">
                        {!$Label.site.forgot_your_password_q}
                    </apex:outputLink>                     
                    <apex:outputText value=" | " rendered="{!$Site.RegistrationEnabled}" />
                    <apex:outputLink value="{!$Page.SiteRegister}" rendered="{!$Site.RegistrationEnabled}">
                        {!$Label.site.new_user_q}
                    </apex:outputLink>                     
                </apex:panelGroup>
            </apex:panelGrid>
        </apex:outputPanel>
    </apex:form>
</apex:component>   
 
Satyadev Revanth ChilakamarriSatyadev Revanth Chilakamarri
Hi,

I encountered the same error.  I added a Visualforce component instead of a Visualforce Page while creating a new file. 
Selecting VF page and pasting the same code fixed the error for me. Not sure if its the same issue with the others.

-Regards,
 Revanth C.
Garima Chaturvedi 4Garima Chaturvedi 4
I'm getting the same error with below code.
<messaging:emailTemplate recipientType="Contact" relatedToType="Account" subject="Case report for Account: {!relatedTo.name}" replyTo="support@acme.com"> <messaging:htmlEmailBody> <html> <body> <p>Dear {!recipient.name},</p> <p>Attached is a list of cases related to {!relatedTo.name}.</p> <center> <apex:outputLink value="http://www.salesforce.com"> For more detailed information login to Salesforce.com </apex:outputLink> </center> </body> </html> </messaging:htmlEmailBody> <messaging:attachment> <apex:repeat var="cx" value="{!relatedTo.Cases}"> Case Number: {!cx.CaseNumber} Origin: {!cx.Origin} Creator Email: {!cx.Contact.email} Case Number: {!cx.Status} </apex:repeat> </messaging:attachment> </messaging:emailTemplate>

Note:This code does not use <apex:page> tag at all.
shivam sharma 44shivam sharma 44
Hi All,

This seems to be an old post.I was facing the same error, Well i just created a new page and copy paste the code.
it is not showing the error. it may be due to the aligment of the tag.

**Note i didnot remove the default <apex:page></apex:page> tag present on new page. just add the attribute.
Albert Joseph Felix 10Albert Joseph Felix 10
Hi,

I'm facing the same error, but with a different approach, This happen when I try to delete a class on Production since it wasn't needed anymore.

so any Ideas?  and that is all the message contains. so it is really difficult to troubleshoot and find the cause.

Thanks
Marcin TrofiniakMarcin Trofiniak
Hi I had similar error when i did copy code from web page and quote were strange: ( regular ) " , ( copied ) ” . Switching them regular fixed the problem.
StrattenStratten
This might not solve it for everyone, but Marcin's solution worked for me. The snippet I copied had the wrong type of quotes. 
Ganesh RajputGanesh Rajput
try this one

<apex:page standardController=\''+obj+'\' extensions=\'seg_'+label+'Controller\'>hello</apex:page>';
        
Diego García 3Diego García 3
Hi everybody! 
I got the same error message:  Error: <apex:page> is required and must be the outermost tag in the markup at line 1 column 1  while copy&paste the Embedded Service Code Snippets to complete the "Create Pre-Chat and Offline Support Forms" challenge.
I did try in another explorer but still got the same error.

Any tip to clear my badge? I don´t have the basics on apex/visualforce!

Thanks a lot!

Diego García
Maheshchandra Patel 1Maheshchandra Patel 1
Hi, Everyone
For Visualforce page code, Leave it first 3 lines and last line as it is. Make it paste between this lines. In short, whatever you copied code you have to paste between line 4 to 72.
Thanks
Olubukola BalogunOlubukola Balogun
Leave in the <apex:page > on the first line and the last line of the code
Delete every other thing and paste your new code.
Make sure the first line of code is <apex:page > and the last line of code is <apex:page >
Luis Aguiar 10Luis Aguiar 10
i had the same issue, in reverse. even with a simple <apex:page></apex:page>, it was complaining for a missing <aura:component>

It turns out i created a component by mistake, and inserted a page code. Meaning in the metadata, it was still an <aura:component>. Maybe you did the opposite?