Guides

Server Scripts are disabled. Please enable server scripts from bench configuration

Mukunda ·1 Nov 2026 ·3 min read

Applies to: Frappe v16.54.0, ERPNext v16.53.0. Self-hosted bench. Checked 2026-11. Not checked on v15. The Frappe docs say this default started in v15.

Run this command in your bench folder. It enables Server Scripts for every site on the bench:

bash
bench set-config -g server_script_enabled 1

The -g is important. The older forum answer bench --site <site-name> set-config ... did not work for us on v16.

Symptom#

A Server Script runs (an API call, a DocType event or a button). Desk shows a "Server Scripts Disabled" dialog with this message:

text
Server Scripts are disabled. Please enable server scripts from bench configuration.

Server Scripts Disabled dialog in Desk

A REST call to an API Server Script returns HTTP 403 with "exc_type": "ServerScriptNotEnabled".

The Server Script form also shows a yellow banner:

text
Server Scripts feature is not available on this site. To enable server scripts, read the Official Documentation.

Yellow banner on the Server Script form

You can still create and save a Server Script. It fails only when it runs.

Cause#

Frappe reads server_script_enabled only from sites/common_site_config.json. This file is shared by all sites on the bench. Frappe does not read the key from a site's own site_config.json. The check is is_safe_exec_enabled() in frappe/utils/safe_exec.py.

Server Scripts run Python on your server. So they are off by default, to keep shared benches safe.

Fix#

  1. Go to your bench folder.

    bash
    cd ~/frappe-bench
    
  2. Set the key in the common config.

    bash
    bench set-config -g server_script_enabled 1
    
  3. Check the file.

    bash
    grep server_script sites/common_site_config.json
    

    We got this output:

    text
     "server_script_enabled": 1,
    
  4. Run the script again. Our API script worked on the next call, with no restart. Frappe caches this file in memory for up to 60 seconds. If it still fails, wait one minute or run bench restart.

What did not work#

This command is the accepted answer on one forum thread. It also appears in the Frappe docs:

bash
bench --site <site-name> set-config server_script_enabled true

It writes the key to sites/<site-name>/site_config.json. On v16.54.0 our API script still returned ServerScriptNotEnabled after it. Frappe does not read the key from that file. This explains the forum thread "Server Script Enabled but message is still showing".

You can remove the unused key from the site config:

bash
bench --site <site-name> set-config server_script_enabled false

Check that it worked#

Call an API Server Script. Our script had the API Method unpaid_invoice_count:

bash
curl -H "Authorization: token <api_key>:<api_secret>" \
  https://<your-site>/api/method/unpaid_invoice_count

Before the fix, it returned HTTP 403. After the fix, it returned {"message":2}. The yellow banner on the Server Script form is also gone.

The Server Script API returns a result after the fix

If it still fails#

  • Check the spelling. The key is server_script_enabled, with a "d" at the end. A forum user had server_script_enable.
  • On Frappe Cloud you cannot edit common_site_config.json. The Frappe docs say shared benches do not allow Server Scripts, and you need a private bench. We did not test this.
  • -g enables Server Scripts for every site on the bench. Any System Manager on any of those sites can then run Python on your server. Do not do this on a bench that hosts sites for people you do not trust.
  • If a script call fails with a different error, see Function ... is not whitelisted.
  • Look in ~/frappe-bench/logs/ for the newest error. Post it on discuss.frappe.io with your versions (bench version).

Sources#

Need help? Hire a Frappe developer