Skip missing attachments during bulk export?

I’m trying to use the bulk export function using mmctl to recover a Mattermost on a broken linux install. I managed to pull my files & DB from the broken server and have got MM running though it seems that somewhere along the way, maybe a previous migration, maybe in this recovery attempt not sure, some attachments have been removed. After running:

mmctl export create

The job runs and exports everything up to the file attachments then runs into this error:

{"timestamp":"2023-08-16 22:48:47.735 -04:00","level":"error","msg":"SimpleWorker: job execution error","caller":"jobs/base_workers.go:83","worker":"ExportProcess","job_id":"8qn5bm8ouj8efmhd3djyq9ddoa","error":"FileReader: Unable to get a file reader., unable to open file 20220201/teams/noteam/channels/1cs686q9of8yjjrd4zy6yafs1c/users/tdio5gsxmpnu3mn9arz7i1qoic/yntjb8dcujnu5m48up5m7iu1wr/Image Pasted at 2022-2-1 18-31.png: open data/20220201/teams/noteam/channels/1cs686q9of8yjjrd4zy6yafs1c/users/tdio5gsxmpnu3mn9arz7i1qoic/yntjb8dcujnu5m48up5m7iu1wr/Image Pasted at 2022-2-1 18-31.png: no such file or directory"}

Steps to reproduce
I suppose this could be reproduced if an attachment were removed from the data folder.

mmctl version is 7.5.2.

My question
Is there a way to bulk export and omit only broken attachments? I see the flag that allows me to omit all attachments, but would like to keep any that do exist, intact.


Hi Michael,

Welcome to the Mattermost Community Forums!

I’m sorry to hear that you’re experiencing issues with the bulk export function in Mattermost. It seems that the error you encountered is related to missing attachments in the data folder.

Currently, there isn’t a specific flag or option in mmctl to exclude only broken attachments during the bulk export process. The --exclude-attachments flag is designed to exclude all attachments, which may not be what you’re looking for.

However, there might be a workaround you can try. You can manually copy the attachments from your backup files to the appropriate location in the new Mattermost installation. This way, you can ensure that existing attachments are preserved even if some are missing.

Here are the general steps to follow:

  1. Verify that you have a backup of the attachments from the broken server.
  2. Identify the missing attachments mentioned in the error message.
  3. Copy the missing attachments from your backup to the corresponding location in the new Mattermost data folder. In this case, it seems to be data/20220201/teams/noteam/channels/1cs686q9of8yjjrd4zy6yafs1c/users/tdio5gsxmpnu3mn9arz7i1qoic/yntjb8dcujnu5m48up5m7iu1wr/.
  4. After copying the attachments, you can retry the bulk export using mmctl export create to see if the process completes successfully.

Remember to make backups of the current data folder in case anything goes wrong during the copying process.

I hope this workaround helps you preserve the existing attachments during the bulk export process. Let me know if you have any further questions or need additional assistance!

Best regards,
~Matterbot 2.0 :robot:

[Disclaimer: This is a new AI response feature we’re testing powered by ChatGPT. Please note that this suggestion may not always reflect official Mattermost recommendations or support.
Were any of the above suggestions inaccurate? Let us know by replying to this comment!]