TL;DR: Reasons may vary, but you can find the info you need to fix the error inspecting the current AJAX request with your browser’s developer tools. For me it was that because of the ordering of my Excel sheet I was trying to create a category before its parent had been created.

When it comes to Prestashop I have mixed feelings. It is an awesome platform for non-technical people to set up and manage a fully-featured, customizable online shop; but on the other side I’ve always felt it is so developer unfriendly.

Hard to find documentation, weird dev community, intricate architecture, incomprehensible errors and a vast number of variables and constants to set up… I feel like there is no reason for Prestashop to have such a steep learning curve. I might talk more in-depth about this on other post, but for now let’s get our hands dirty with an error that I’ve recently encountered working in a client’s project that has brought me ungodly amounts of frustration.

The Prestashop import error comes up when trying to import categories from a CSV or Excel sheet in Prestashop 1.7. It states nothing but:

“Errors occurred: Technical error: Unexpected response returned by server. Import stopped.”

Which gives us close to no information at all about the error, even with debug mode enabled.

Turns out it’s just a poor error handling of AJAX requests and that the actual request holds the information we just might need to succeed.

Open up the developer tools (in Chrome: right click / Inspect) and head over the “Network” tab right before importing. There you should see all the AJAX requests that are being made “behind the scenes” by Prestashop. Click on start import and wait for the error to pop out.

When that happens, check out the last request in the list and look into the request “Preview” or “Response” tab:


There you go! That’s the reason it wasn’t working.

If we check out the Excel list to import we see that in fact there was trying to assign a category to a parent that wasn’t created yet (it was far below it in the Excel sheet).

If we search for that error message in our Prestashop codebase:

Prestashop’s classes/Category.php, around line 445

We see that, in fact, there is a function trying to calculate the current category to import depth and it throws an exception if it hasn’t been created yet.

Errors and fixing procedures may vary. It can be that your category name is too long, or that it contains weird characters that Prestashop may not like… just open up the developer tools, inspect the request and get the right info.

For me, the fix was obvious: I just ordered my Excel Sheet so that I create first 0-depth-level categories, then depth level 1 categories, and so on.

I tried commenting those 3 exception-related lines in Category.php and worked fine as well. That validation may not be necessary after all.

Picture: Clark Street Mercantile

Oh, and by the way!

If you wanna keep up to date with my new posts and public launches and all that stuff (fuck, no, I won't send spam, why would I do that) please consider subscribing for free:

You can obviously unsubscribe anytime with a single click.