I created a visualforce page, and wrote 175,342 lines of code in it. The total view state is 38 kb. I need to add another 1,000 lines of code, at least, to the page. When I try to do this, I get the error "max length=1048".

How can I resolve this?

  • 1
    That is an absolutely insane amount of markup.
    – Adrian Larson
    Commented Jan 18, 2017 at 14:51
  • Are you sure you didn't copy by mistake an entire Harry Potter Book Series content in there?
    – o-lexi
    Commented Jan 18, 2017 at 20:53

2 Answers 2


Here what I can see is there are so many lines of code present in your Visualforce page in order to handle complex functionality.

You can use templating feature of visualforce , where you can add similar block of code inside a Visualforce component and make size of your page small.

You can read more about this here.



Depends on size of VF page. maximum size of visualForce page 135 KB. I think you have exceeded 135 KB . You can also check the page size from view state of your page.

Go to Setup > My Personal Information > Personal Information > Check Development Mode > Check Show View State in Development Mode.

Refer to below links.



  • 1
    OP said: "view state is 38kb".
    – Dan Jones
    Commented Jan 18, 2017 at 10:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .