# Missing attachments (files/dirs) causing bulk export/import to fail

**URL:** <https://forum.mattermost.com/t/missing-attachments-files-dirs-causing-bulk-export-import-to-fail/12347>\
**Category:** Troubleshooting\
**Created:** [October 18, 2021, 12:59am UTC](https://forum.mattermost.com/t/missing-attachments-files-dirs-causing-bulk-export-import-to-fail/12347 "2021-10-18T00:59:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Urge4Vert](https://avatars.discourse-cdn.com/v4/letter/u/6a8cbe/32.png) [@Urge4Vert](https://forum.mattermost.com/u/Urge4Vert)\
**Post date:** [October 18, 2021, 12:59am UTC](https://forum.mattermost.com/t/missing-attachments-files-dirs-causing-bulk-export-import-to-fail/12347/1 "2021-10-18T00:59:55Z")

</div>

**Summary**  
Missing files in the data/ dir are causing bulk export/import to fail when I’m trying to include attachments

**Steps to reproduce**  
Delete files from the data/YYYYMMDD directories  
Try to run a bulk export with attachments and it will fail  
Try to run a bulk import with attachments and it will fail

**Expected behavior**  
The failure is expected, I just need a work around

**Observed behavior**  
Error: BulkImport: Error reading the file at: “/opt/mattermost/old-data/teams/bf5w9anc9bnz8xyfi7tsyemzeh/channels/8oxq5fej8p8qmddfpwgeax49me/users/qg5qfw63utymdcibe3w35oy5uc/mrdkaoyuhtgpzbgfge3ou58hjh/Image Pasted at 2017-5-23 13-51.png”, open /opt/mattermost/old-data/teams/bf5w9anc9bnz8xyfi7tsyemzeh/channels/8oxq5fej8p8qmddfpwgeax49me/users/qg5qfw63utymdcibe3w35oy5uc/mrdkaoyuhtgpzbgfge3ou58hjh/Image Pasted at 2017-5-23 13-51.png: no such file or directory

**Versions**  
Current mattermost is 5.33.3  
Trying to import to 5.37.2

Since I have a database issue right now, I’m unable to upgrade my version of mattermost. So, I’ve decided to try a bulk export and then import to a new instance. The issue is, somewhere along the way it looks like a number of directories were deleted from the data directory. Because of this, when I try to export with attachments, it fails saying it can’t find the file. Which is correct because the file isn’t there. Same happens when I try to do a bulk import and I’ve moved the data directory by hand (its still missing the same files of course).

Also, when I try to do an export it fails with a similar error because of the missing file. I’ve tried bulk export and using mmctl and both fail at the missing file/attachment

Is there some work around where I can say ‘yes, its missing attachments, please just continue’?

_Side note:_  
I cannot upgrade the current mattermost because of this database error. I’ve tried several different versions but I cannot use anything newer than 5.33.3. But I would rather migrate to another instance of mattermost  
{“level”:“error”,“ts”:1634518984.4649901,“caller”:“sqlstore/store.go:170”,“msg”:“Failed to apply database migrations.”,“error”:“Dirty database version 1. Fix and force version.”}

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [October 18, 2021, 2:21pm UTC](https://forum.mattermost.com/t/missing-attachments-files-dirs-causing-bulk-export-import-to-fail/12347/2 "2021-10-18T14:21:52Z")

</div>

We have a fix submitted for this, which we are planning to backport to 5.37.x.

---

<div class="post-metadata">

**Author:** ![Urge4Vert](https://avatars.discourse-cdn.com/v4/letter/u/6a8cbe/32.png) [@Urge4Vert](https://forum.mattermost.com/u/Urge4Vert)\
**Post date:** [October 18, 2021, 4:45pm UTC](https://forum.mattermost.com/t/missing-attachments-files-dirs-causing-bulk-export-import-to-fail/12347/3 "2021-10-18T16:45:50Z")

</div>

Is there any way I can apply that fix? I’m a little stuck since I can’t upgrade, and I can’t migrate to another instance.

Thanks
