I am experiencing this error when Importing stock via CSV file:

systemException Additional data: Warning: Undefined array key "source_code" in /var/www/html/vendor/magento/module-inventory-import-export/Model/Import/SourceItemConvert.php on line 40

My file passes validation and always fails this.

enter image description here

Any help appreciated. Also cant find anything in the exception log

  • There might be a space in the cell.
    – Cladiuss
    Commented Aug 5, 2023 at 21:47
  • which exact version you are using ?
    – Pawan
    Commented Aug 6, 2023 at 3:19

3 Answers 3


I had the same issue in our project. I fixed it by doing these:

1- TRUNCATE TABLE importexport_importdata; 2- TRUNCATE TABLE import_history;

You can try this please take a backup from your database before making any modifications.

if this answer solved your problem mark it as resolved.



I think it is a problem with the Magento inventory module, I am using the same template that I used in version 2.4.6. and now it doesn't work in version 2.4.6-p1, even if you download a file from the current stocks, and then try to upload it, I get the error.

  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Aug 9, 2023 at 20:30

I have made a hotfix module you can download it from here:


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.