Fix the “This file should not be imported in this context” Divi error

aniaromanska

Written by Ania Romańska

Published on . Last edited on .

Fix the This file should not be imported in this context Divi error

TL;DR

Every Divi export file starts with a context value, for example {"context":"et_builder", and Divi only imports the file where that context matches; otherwise it shows “This file should not be imported in this context.”

et_builder is a page layout: import it in the Visual Builder (Divi 5: gear icon in the top-left corner → Import; Divi 4: purple dots → Portability icon → Import tab).

et_builder_layouts is a Divi Library export (Divi → Divi Library → Import & Export), et_theme_builder is a Theme Builder export (Divi → Theme Builder → Portability icon), epanel comes from Divi → Theme Options and et_divi_mods from the Theme Customizer.

The Divi Library import also accepts a page layout (et_builder) and converts it into a Library layout, but the Visual Builder’s page import accepts only et_builder files.

Divi 5 imports Divi 4 page layouts and converts them; a file with no context or with broken JSON also triggers the same error, and a .zip has to be unzipped before import.

Updated for Divi 5: Divi 5 still shows this error with exactly the same wording, and the fix is still the same: import the file in the place it was exported from. The import buttons moved in Divi 5, so every step below shows the Divi 5 path first and the Divi 4 path next to it.

Have you ever tried to import a JSON file into Divi only to be met with the frustrating notification saying: “This file should not be imported in this context”? Whether you tried to import a free layout from somewhere else or a layout you have exported yourself, this error might have appeared and made quite a snag in your plans.

"This file should not be imported in this context" Divi error
So annoying, right?

But no worries! Today, I’ll tell you exactly why this happens and how to fix it if it does. I’ll also share a nifty little trick that will help you avoid seeing this error ever again!

And psst! I know how annoying it can be to read a full explanation if all you need is a simple, quick fix. If you want the TL;DR version of the solution, scroll down to the last section, The quick fix.

What does “This file should not be imported in this context” mean?

It means the JSON file was exported from a different part of Divi than the one you are importing it into. Every Divi export file starts with a context value, and Divi refuses the import when that value doesn’t match the place you’re importing into.

This statement may be quite confusing, because ‘context’ is a word with quite a broad meaning. Here, it means:

Context: the situation or environment in which a file was exported/imported.

This context can be the Divi Builder (a single page layout), the Divi Library, the Theme Builder, or one of the settings screens (Theme Options, the Theme Customizer, the Role Editor). So what this error message means is that the file cannot be imported into the environment you’re trying to import it into. For example, if you’re trying to import a JSON file into the Divi Builder and you see this error, it means that you are importing it into the wrong environment.

Divi 5 shows the same message in two more situations: when the file has no context at all, and when the file isn’t valid JSON (for example a broken download, or a JSON file exported by another plugin). I tested all of these on a Divi 5.18 site, and each one ends with the same “This file should not be imported in this context” message.

Why does the context matter?

Because each part of Divi saves different data: a page layout, a list of Library items, Theme Builder templates or theme settings. Divi’s import (it’s called Portability) only knows how to read the kind of file its own export created, so it checks the context first.

So the rule is: import a file in the same context in which it was exported. If a file was exported from the Divi Builder, import it into the Divi Builder. If it was exported from the Theme Builder, import it into the Theme Builder.

There is one friendly exception in current versions of Divi 4 and in Divi 5: the Divi Library import also accepts a page layout exported from the Divi Builder, and turns it into a Library layout automatically. It doesn’t work the other way around: a file exported from the Divi Library can’t be imported directly into a page.

How to fix the “This file should not be imported in this context” Divi error

Import the file in the same place it was exported from. Check the context (see the next section if you don’t know it), then use the matching import below.

So far so good, right?

But what if you downloaded a layout (for example, this cute About Us page layout for a business couple!) and don’t know how it was exported? Should you just keep trying to import it in different contexts until you find the one that works?

Of course not! That would be quite frustrating, right? Thankfully, there is a shortcut. For one, if you’re using a layout from Divi Lover, it will always come with a brief Read Me file that will tell you in which context the layout should be imported. Most Divi web designers who share free layouts will include this information.

Also, layouts are often downloaded as a .zip file. Unzip it first and import the .json file that’s inside, not the zip.

Page layouts (context et_builder): import in the Visual Builder

  1. Open the page in the Visual Builder.
  2. In Divi 5: click the gear icon in the top-left corner and choose Import (or click the Export & Import icon in the top bar). In Divi 4: click the three purple dots at the bottom of the screen, then the Portability icon (two arrows), and open the Import tab.
  3. Choose the .json file, pick your options (for example Replace Existing Content or Import Presets) and click the import button.

Divi 5 also imports page layouts exported from Divi 4 and converts them to the Divi 5 format, so an older et_builder file works fine.

Divi Library files (context et_builder_layouts): import in the Divi Library

  1. In your WordPress dashboard go to Divi → Divi Library.
  2. Click the Import & Export button at the top of the page and open the Import tab.
  3. Choose the .json file and import it. Your layouts now appear in the Library list.
  4. To use one on a page: in Divi 5 open Insert Layout → Your Saved Layouts; in Divi 4 use Load From Library → Your Saved Layouts.

In Divi 5 you can also import into the Library without leaving the Visual Builder: in the Your Saved Layouts tab, click the Import icon at the top.

Theme Builder files (context et_theme_builder): import in the Theme Builder

  1. Go to Divi → Theme Builder.
  2. Click the Portability icon (two arrows) in the top right corner and open the Import tab.
  3. Choose the .json file, decide whether it should override your default website template, and import it.

Theme settings (contexts epanel and et_divi_mods)

A file with epanel is a settings file from Divi → Theme Options: import it there with the Portability icon (two arrows) in the top right corner. A file with et_divi_mods comes from the Theme Customizer: import it in Appearance → Customize, using the Portability icon at the top of the Customizer panel. These steps are the same in Divi 4 and Divi 5.

Divi 5 also lets you export and import Variables, Presets, Components and Icon collections. Each has its own Import & Export button in its manager (for example the Variable Manager or the Icon Manager), so import those files back in the same manager.

How to never see this error again: check the context in the JSON file

Open the JSON file in any text editor and look at the very beginning of the file: Divi always writes the context first, for example {"context":"et_builder",. That word tells you exactly where the file should be imported.

All you need is a plain text editor (Notepad, TextEdit, or your code editor). Divi export files are often saved as one very long line, so don’t worry if the whole file looks like a single block of text: the context is always right at the start.

A JSON file opened in Notepad to check the context and fix the "This file should not be imported in this context" Divi error
The beginning of the file tells you the proper context for this file.

For example, “et_builder” means that the correct context for this file is the Divi Builder. The other versions you may see are: “et_builder_layouts” which means the context is the Divi Library, and “et_theme_builder” which means the context is the Theme Builder. You might also encounter this: “epanel”, which means what you’re dealing with is a settings file exported from the Divi Theme Options. Another possibility is that you’ll see “et_divi_mods”, a file exported from the Divi Theme Customizer, or “et_pb_roles”, a file exported from the Divi Role Editor.

So, to recap: if you have a JSON file you’d like to import, and you don’t know in which context it was exported, you can simply open it in a text editor and check the context. All that remains is to import the file in that context.

The quick fix

Import the file where it was exported: check the context at the start of the JSON file and use the matching import.

  • A file can only be imported in the same environment (context) in which it was exported. (The one exception: the Divi Library also accepts page layouts exported from the Divi Builder.)
  • To check the context, open the JSON file in a text editor and look at the very beginning. It will tell you the appropriate context in which you can import the file.

Context options:

  • “et_builder”: page layout exported from the Divi Builder. Import it in the Visual Builder (Divi 5: gear icon → Import; Divi 4: purple dots → Portability icon → Import).
  • “et_builder_layouts”: Divi layouts exported from the Divi Library. Import them in Divi → Divi Library → Import & Export.
  • “et_theme_builder”: templates exported from the Theme Builder. Import them in Divi → Theme Builder → Portability icon.
  • “epanel”: settings file exported from the Divi Theme Options. Import it in Divi → Theme Options → Portability icon.
  • “et_divi_mods”: settings file exported from the Divi Theme Customizer. Import it in Appearance → Customize → Portability icon.

And that’s it! I hope you find this solution to this pesky little problem useful, and hopefully, you’ll never again see the “This file should not be imported in this context” error in Divi. Do you have any other Divi frustrations similar to this one? Share them in my Divi Lovers Facebook group!

This article has been tagged with: Divi Fixes

Tags

Fix the This file should not be imported in this context Divi error

Table of Contents

Popular questions

Why does Divi say “This file should not be imported in this context”?

Divi checks the context value at the start of the JSON file and compares it with the place you’re importing into. If you import a Theme Builder export (et_theme_builder) into a page, or a Divi Library export (et_builder_layouts) into the Visual Builder, the values don’t match and Divi stops the import. Import the file in the place it was exported from.

Can I import a Divi 4 layout into Divi 5?

Yes. Divi 5 imports JSON layouts exported from Divi 4 and converts them to the Divi 5 format. The context rule still applies: a Divi 4 page layout (et_builder) goes into the Visual Builder (gear icon → Import), a Divi 4 Library export goes into Divi → Divi Library → Import & Export.

How do I use a Divi Library export on a page?

Import it into the Divi Library first (Divi → Divi Library → Import & Export). Then open the page in the Visual Builder and load the layout from your Library: in Divi 5 with Insert Layout → Your Saved Layouts, in Divi 4 with Load From Library → Your Saved Layouts.

What if the JSON file has no context at all?

Then it isn’t a complete Divi export: the download may be broken, or the file was created by another plugin. Divi 5 shows the same error for a file without a context and for invalid JSON. Download or export the file again, and if it came in a .zip, unzip it and import the .json file inside.

About the Author

Ania Romańska

I'm a Divi expert from Poland, with over 10 years building the templates and courses that make up Divi Lover. I'm also a mom of five, which taught me a thing or two about explaining things clearly the first time.

Hey there!Sorry to interrupt,but this one's important!

Divi Lover is turning 10!
Let’s celebrate with 40% off everything.

Ten years of Divi templates, plugins and tips, and a brand-new website to celebrate it. To say thank you, every product in the shop is 40% off until Cyber Monday.

Your code

Paste it at checkout. Valid until November 30.