WIP: Import bundle fails with false-positive "Current user lacks the 'bricks_execute_code' builder permission"

Browser: Chrome 152
OS: Windows 11

User Role: Administrator - with bricks_execute_code capability explicitly granted
Bricks Settings: Code execution is enabled

Hi,

When importing a template bundle containing a Code Element (or any template using the Query Editor / sensitive component properties) via the new IMPORT / EXPORT tool in Bricks 2.4 (Settings → IMPORT / EXPORT → IMPORT), the import process is halted with a red banner error:

Current user lacks the "bricks_execute_code" builder permission.
| data: {"code":"bricks_forbidden_builder_permission","permission":"bricks_execute_code"}

Steps to Reproduce:

  1. Create a new Bricks template (e.g., a Header template named Header__Alter).

  2. Add a Section element, then add a Code element inside it.

  3. In the Code element settings, turn ON the Execute code toggle, and enter valid PHP/HTML code (e.g., <h1>Just some HTML</h1><?php echo 'The year is ' . date('Y'); ?>) (Screenshot 1).

  4. Open Builder Settings → IMPORT / EXPORT → EXPORT. Select EXPORT BUNDLE, check only the newly created template (Header__Alter), and click EXPORT BUNDLE (Screenshot 2).

  5. In the target site (or same site), verify that the logged-in user has the bricks_execute_code capability and Code Execution is enabled in Bricks → Settings → Custom Code.

  6. Open Builder Settings → IMPORT / EXPORT → IMPORT. Load the bundle, toggle on Templates (Header__Alter), leave Import images enabled, and click IMPORT BUNDLE (Screenshot 3).

  7. The import fails immediately with the red error banner claiming missing permissions (Screenshot 4).

Import fails with: Current user lacks the "bricks_execute_code" builder permission. | data: {"code":"bricks_forbidden_builder_permission","permission":"bricks_execute_code"}

Observations:

  1. Legacy template export/import (.json template file) imports the same template without issues.
  2. The new Import Bundle tool works fine if the bundle contains templates without Code elements or Query Editor payloads.
  3. Not check/test with “SVG”

Thanks
:bear:

Hi @datgausaigon,

thanks for the report. I was able to replicate it and I’ve added it to our task tracker. Once we release a fix, we’ll update this topic.

Thank you,
Matej

When i export and then import an icon set in the new site the icons are not selected, so i have to re select all the icons again.
The icons do get imported correctly into the new site, but having to manually assign every icon again is the same as not importing anything and doing it all by hand from scratch. This has been happening for a long time. I thought the new version would have fixed it, but it still happens. Even though I checked the option to import images, the icons still aren’t automatically selected on the new site.

Hi @Edison32,

This appears to be a separate issue from the code-execution permission error in this thread. Please create a new forum topic and include the exact export/import steps—particularly whether you use Icon Manager, Import / Export bundles, or the Template Library, and a minimal export containing one element whose icon assignment is lost. Since you already enabled Import Images, please also confirm whether SVG uploads are enabled for your user on the destination site.

Thanks,
Matej

Something new about this issue?
(I’m blocked for my migration to production)

Hi @laksstudio,

we are reviewing this internally. Sadly, I can’t give you date when it will be released, hopefully with next release or when we release 2.5 version.

Matej