Terms and Conditions

Hello there,

when trying to save my full Terms and Conditions ERPNext crashes.

JavaScript Console says:

Failed to load resource: the server responded with a status of 500 (Internal Server Error)
desk:1 Uncaught SyntaxError: Unexpected token <


Uncaught SyntaxError: Unexpected token <

Cutting off a few lines of text the Terms and Conditions are saved properly. I don’t know where to start to debug this.

May anyone reproduce this?

Thank you.

Edit: I got a trace after waiting a few seconds:

    Traceback (innermost last):
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/app.py", line 69, in application
    response = frappe.handler.handle()
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/handler.py", line 77, in handle
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/handler.py", line 94, in execute_cmd
    ret = frappe.call(method, **frappe.form_dict)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/__init__.py", line 788, in call
    return fn(*args, **newargs)
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 18, in savedocs
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/document.py", line 251, in save
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/model/base_document.py", line 307, in db_update
    ), d.values() + [d.get("name")])
  File "/home/ubuntu/frappe-bench/apps/frappe/frappe/database.py", line 135, in sql
    self._cursor.execute(query, values)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/ubuntu/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
 OperationalError: (2006, 'MySQL server has gone away')

Hello there,

i found out the following solution for everyone who is experiencing the same problem with large inputs:

  1. locate your mysql config file. Mine is /etc/mysql/my.cnf but it may be also /etc/my.cnf or others. Look at the top answer at linux - How do I find the MySQL my.cnf location - Stack Overflow to figure out the right path.

  2. Use the following in your ssh client:

    sudo vi /etc/mysql/my.cnf

  3. Scroll to your option “query_cache_limit”. Mine was query_cache_limit = 128K

  4. Change it (in vi press I to enter editing mode) to query_cache_limit = 256K or more. You have to try how much is necessary. I think 256K or maximum 512K should be fine.

  5. save your changes by using CTRL + C, then type :wq and hit enter.

  6. Reload (or restart if necessary) your mysql daemon by typing

    sudo service mysql reload


sudo service mysql restart

Try saving your data again. It should be fine now.


@ci2016 Thanks for sharing your solution!

1 Like

You’re welcome. I always will post and share so we have a information rich community.

1 Like