General System Exception Happened: How To Fix Error During Magento 2 Import

- Magento 2, Our extensions

Magento 2 Development; Magento 2 tutorial

In the following post, we try to figure out what the “General System Exception Happened” error is and how to fix it. The issue is an inevitable part of the Magento 2 import processes, but we know for sure how to solve it. The question was initially asked by Stax. Below, we describe two different solutions: the time-consuming one and the user-friendly one. More useful tips are gathered here: Developer’s Cookbook.

'

How to Fix General System Exception Happened Error

The reason for the “General System Exception Happened” error is the content of your import file. Characters should be coded to UTF-8-BOM. Thus, you always have to do that before importing any data into Magento 2.

  1. Open the CSV in Notepad++;
  2. Go to Encoding;
  3. Convert your file to UTF-8-BOM;
  4. Save it as a copy;
  5. Import the saved file.

The procedure is extremely straightforward, but you have to repeat it before every import. Right, all data files should be encoded to prevent the “General System Exception Happened” error. So you will have to spend lots of time in a long-term perspective. Do you really want that? If not, let’s find out what is BOM and how UTF-8 differs from UTF-8-BOM and then proceed to a more user-friendly approach to solving the issue.

What Is UTF-8-BOM & How It Differs From UTF-8?

Although there is no official difference between UTF-8 and UTF-8-BOM (Byte Order Mark), it is crucial for the Magento 2 import. The BOM-ed version of a UTF-8 string starts with the three following bytes: EF BB BF. Note that it is recommended to ignore them when extracting the string from the file/stream.

BOM is considered additional information for UTF-8 and could be an excellent way to find out whether a string was encoded in UTF-8. At the same time, it could be a legitimate string in any other encoding. Paercebal provides the following example: [EF BB BF 41 42 43]. It could be either the ISO-8859-1 string “ABC” or the UTF-8 string “ABC”.

This example shows that the first bytes are not always helpful when you want to recognize the encoding of file content. The example string is just a bunch of bytes, so some external information is needed to choose how to interpret it. If you thin ISO-8859-1 was used to encode the bytes, then the string is “ABC”. If it was UTF-8, then the string is “ABC”. The BOM could be a clue in case you don’t know the truth.

Protip: An absence of invalid character when decoded as UTF-8 is another way to find what string you deal with. And invalid characters cause “General System Exception Happened” error. That’s why BOM is required for the Magento 2 import.

Unfortunately, BOM may cause various problems (beyond the import process of course). First of all, if a file with no text is BOM-ed, it is no longer empty because it always contains some additional bytes.

Another issue is related to the ASCII subset of UTF-8. A file is no longer ASCII because the BOM is not ASCII. Such peculiarity makes some existing tools break down. If there is no replacement for them, you will face serious troubles.

And don’t forget that you cannot concatenate several files together because each of them has a BOM at the beginning.

Now, when you are familiar with the reason for our problem, know how to fix it, and understand what BOM is, we can proceed to the preventive measure. If you don’t want to convert files to UTF-8-BOM every time a new import process is required, continue reading this article – you will find a cure for your headaches below.

How to Prevent General System Exception Happened Error

To prevent the “General System Exception Happened” error, you need the Improved Import & Export Magento 2 extension. This module not only helps to avoid the issue but it also makes data transfers much faster, provides the ability to automate them entirely, offers multiple ways of data migration, as well as solves the problem of different attribute standards.

If you want to forget about the “General System Exception Happened” error and move your import and export processes to an entirely new level, give it a try. Let’s take a look at what the Improved Import & Export module can.

Improvements For Default Import & Export

Magento 2 mysql data import

Our extension is designed to revamp the default import and export tools entirely. It not only solves the problem mentioned above but also increases the speed of updates as well as ads multiple features the dramatically improve your admin experience. Below, we shed light on the core module’s characteristics.   

Extended Connectivity Options

One of the most obvious enhancements provided by the Improved Import & Export plugin is a bunch of connection options. Our extension supports multiple connectivity standards that simplify even the most complicated integrations between your Magento 2 website and external systems which can be based on API connections, file transfers, or intermediary services.

Multiple File Standards

It’s not a secret that the Magento platform works with CSV files only. That’s why we’ve been encoding a CSV file at the beginning of this post. The necessity to work with this only format is partially a reason for the problem. A strict limitation that prevents using other file formats forces you to convert all data to CSV (UTF-8-BOM) every time a new update is provided.

Luckily, the Improved Import & Export Magento 2 extension significantly extends the number of supported standards. In addition to CSV, it provides the ability to use XML, JSON, ODS, and Excel files. Consequently, there is no need to convert them to CSV or vice versa. Our module lets you effortlessly transfer data in these formats. Furthermore, you can apply all the extension’s features to all supported standards!

Multiple File Sources

And it is necessary to mention that you can choose one of several supported file sources. The Improved Import & Export Magento 2 extension extends the flexibility of every integration with the following connection points:

  • FTP/SFTP. Use a local or remote server to exchange data between your Magento 2 website and an external platform.
  • Dropbox. Use a Dropbox account to exchange data between your Magento 2 website and an external platform.
  • URL. Use a direct URL address to run import processes only.

We’d also like to draw your attention to the fact that the Improved Import & Export Magento 2 extension unpacks compressed data automatically. If an update is provided in an archive, you don’t have to extract it manually. It means that you no longer need to unpack a file, convert it to CSV, and then encode to BOM-ed UTF-8 to prevent the “General System Exception Happened” error – everything is done for you!

Direct Connections

Chances are, you cannot use files to establish all required connections. But there are no reasons to worry since the Improved Import & Export Magento 2 extension provides the ability to connect to an external system directly. The module lets you establish a direct API connection between Magento 2 and any third-party platform that also support this type of integration. To create the bridge between the two systems, the Improved Import & Export Magento 2 extension lets you use REST, SOAP, or GraphQL APIs.

Intermediary Services

If neither API connections nor file transfers are helpful, you can rely on various intermediary services. Under such services, we assume online sheets. Currently, the Improved Import & Export Magento 2 module provides the ability to leverage the three following platforms: Google Sheets, Office 365 Excel, or Zoho Sheet. Below, you can see how to transfer between your store and an external system using Google’s solution:

Magento 2 Google Sheet import

Automated Import & Export Processes

As we’ve already mentioned, you have to repeat the same procedure of encoding every time a new update is provided. Even if the file is BOM-ed UTF-8, it is necessary to run import manually, which is a time-consuming routine. What alternative solutions do we offer? The Improved Import & Export Magento 2 extension provides two different approaches to making every data transfer independent. You can either create an update schedule or choose an event that will be used as a trigger. Let’s explore each feature separately.

Schedules

Schedule-based updates are very intuitive. The Improved Import & Export Magento 2 extension uses cron to enable the feature. When in the extension’s admin, specify a custom update period utilizing the default cron syntax. Alternatively, you can select one of the predefined intervals, which are fully customizable as well.

At the same time, you have an opportunity to create profiles that have no schedules. Why are they important when you can automate everything? Single data transfers and asynchronous updates are the answer. In some situations, you will need to import data only once or do that in a random order.

And don’t forget that every profile can be launched manually even if it has a schedule. If your partner delays the update, you won’t need to wait until the next planned event. Hit a few buttons, and the Improved Import & Export will do everything for you. The following illustration shows how to configure a schedule:

Events

Events are an alternative way of automating import and export processes. You can even use them to enable real-time updates. It is only necessary to select a trigger when you configure a certain import or export job. Any event can be a trigger; for instance, a customer places an order. It can launch an order data export to an external system, so the data is transferred in real time.

The Improved Import & Export Magento 2 extension lets you both select system events and specify custom processes considered triggers. And it is possible to increase their efficiency by selecting specific conditions. For further information, read this article: How to Run Magento 2 Import or Export After Specific System Event or Process.

Advanced Mapping Features

Another issue that prevents fully automated import and export processes is different attribute standards. Since external systems store data in different ways, it is not possible to transfer information between them directly. You always have to modify the external output matching it to Magento 2 requirements.

Luckily, the Improved Import & Export Magento 2 extension offers advanced mapping functionality that substantially simplifies all the related processes. Problems caused by different attribute standards can be efficiently solved right within our module. It lets you modify not only third-party attributes but also their values. Furthermore, you can use the created matching schemes for further import/export processes so that updates are entirely automated.

Mapping Presets

The easiest way to solve the problem of different data standards is based on presets. Our team has created a bunch of mapping schemes that can be applied just within a few clicks. You only have to select a preset suitable for your particular integration. Thus, the Improved Import & Export Magento 2 extension allows matching the external attributes to ones used in Magento 2 in a few clicks only. You select a mapping scheme, and the module scans the input data, analyzes all attributes, and matches all third-party designations to the corresponding ones used internally. Everything is as simple as shown below:

Matching Interface

If you cannot find the necessary preset, the Improved Import & Export Magento 2 extension lets you do everything manually. Of course, you can also rely on our support and ask us for help, but the module offers a special interface where you can easily match attributes manually. The complicated data file editing is reduced to selecting a third-party designation and specifying the appropriate internal one in front of it. You should repeat the procedure for every attribute that differs from the ones used in Magento 2. The process has the following appearance:

Also, note that you can specify hardcoded attribute values via the same interface. On the gif above, you can see the third column called “Default Value” which allows setting a value provided to all items related to the attribute.

Let’s assume that you need to import products related to different store views to one store view. With the Improved Import & Export extension, it is possible to link them to the same destination via the hardcoded value functionality.

Attribute Values Mapping

As mentioned above, similar functionality is possible for both attributes and their values so that you can freely map them. The Improved Import & Export Magento 2 extension uses the same algorithm for modifying the external data as we’ve just described. But third-party values don’t prevent import processes, you will argue. Indeed, they require lots of time and effort for editing after the update is transferred. That’s why we’ve implemented attribute values mapping in our module.

The Improved Import & Export Magento 2 extension provides a powerful feature that is easy to master and use. The provided attribute values mapping is much faster than doing everything manually via a data file or in the Magento admin. You no longer need to apply changes to each product individually working right with attribute values instead. More information is available here: Attribute Values Mapping.

Attribute Values Editing

For the further simplification of your admin duties, we’ve introduced the ability to edit attribute values in bulk. With the Improved Import & Export Magento 2 extension, you can apply one of the following rules:

  • Add a prefix;
  • Add a suffix;
  • Split attribute values;
  • Merge attribute values.

Feel free to combine them and create special conditions to increase efficiency and precision. For further information, read this article: How to Modify Attribute Values During Import and Export in Magento 2.

Category Mapping

And with the Improved Import & Export Magento 2 extension, you can freely map categories. This feature is especially useful when you import products with a different catalog structure. Instead of applying changes to each imported product individually from the admin interface, match the external categories to the ones used internally during the import process:

And you can create new categories on the fly as well. With our module, the process is as simple as selecting a parent category and specifying a name of a new one. For further information, follow this link: Category Mapping.

Attributes On The Fly

And the absence of attributes is no longer a problem since the Improved Import & Export Magento 2 extension allows you to create them on the fly. All the necessary parameters can be specified using the following general form:

Attribute|attribute_property_name:attribute_property_value|…

For further information, read this article: Product attributes import.

The following video shows the Improved Import & Export Magento 2 extension in action:

Final Words

As you can see, the Improved Import & Export Magento 2 extension not only prevents the “General System Exception Happened” error but also allows solving multiple other import and export issues related to the standard data transfer tools. Our module provides the ability to automate the exchange of information saving tons of time and effort. For further information, follow the link below and contact our support:

Get Improved Import & Export Magento 2 Extension

'