Slack import fails because attachment was not found

Summary
Slack import fails because attachment was not found

Steps to reproduce

  • Install Mattermost with Docker using → http s://mattermost.com/deploy/ (have to split it because new users can only post 2 links here)
  • Create team ‘testtest’ with mmctl
  • Copy ‘mattermost-bulk-import-test.minimal.zip’ (since you can’t upload files here, see screenshots and code at the bottom) into mattermost/data/import
  • mmctl import process mattermost-bulk-import-test.minimal.zip
  • mmctl import job show $jobid --json → results in error:
"data": {
      "error": "We could not count the users. — BulkImport: Error while processing bulk import attachments., attachment \"data/bulk-export-attachments/aa.pdf\" not found in map",
      "import_file": "mattermost-bulk-import-test.minimal.zip",
      "line_number": "4"
    }

Server log shows:

"error","msg":"SimpleWorker: Failed to get active user count","caller":"jobs/base_workers.go:83","worker":"ImportProcess","job_id":"pwwapx4i9fde5ezs1iidwa5yha","error":"BulkImport: Error while processing bulk import attachments., attachment \"data/bulk-export-attachments/aa.pdf\" not found in map"

With this setup im using mmctl v7.1.2 and mattermost 7.1.3. But i also tried it on a system with mmctl v7.0.1 and mattermost 7.0.0.

Expected behavior
Import should succeed.

Observed behavior
The import data i created is almost identical to mattermost-bulk-import.workaround.zip that can be found on GitHub issues. ‘mattermost-bulk-import.workaround.zip’ does work for me. However, i have to copy it to the import folder everytime before i reimport it, otherwise i will get the same error. With the import data i have created it fails. I noticed that in the above mentioned GitHub issue the user got a slightly different error message. Mine has ‘We could not count the users.’ appended at the front.

What is the problem with my import data? I can not see any problem with it.

Since you can’t upload files here, here are a screenshots and code:

mattermost_import.jsonl

{"type":"version","version":1}
{"type":"channel","channel":{"team":"testtest","name":"general","display_name":"new-general","type":"O","header":"","purpose":""}}
{"type":"user","user":{"username":"test","email":"test.test@test","auth_service":null,"nickname":"","first_name":"test","last_name":"test","position":"","roles":"system_user","locale":null,"teams":[{"name":"testtest","roles":"team_user","channels":[{"name":"general","roles":"channel_user"}]}]}}
{"type":"post","post":{"team":"testtest","channel":"general","user":"test","message":"This is a test","props":null,"create_at":1618903303001,"replies":[],"attachments":[{"path":"bulk-export-attachments/aa.pdf"}]}}

Screeshot of file structure:

Hi felix and welcome to the Mattermost forums!

The import instructions have been modified recently to reflect the necessity for the subfolder, please see this link.

It’s necessary that the “data” folder is directly in the root of the ZIP file, not sure if your screenshot confirms that fact, looks like an OSX screenshot and I’m not sure if I interpret it correctly.

Can you run zipinfo mattermost-bulk-import-test.minimal.zip to verify that?

The error message “We could not count the users” is misleading and will be fixed in one of the next versions. The default error message is not handled properly unfortunately.

1 Like

Thanks for the fast response!

The data folder in fact was not in the root. I zipped a folder named ‘mattermost-bulk-import-test.minimal’ that contained the data folder and the jsonl file.

Now it works. Thanks a lot! :slightly_smiling_face:

Awesome, glad to hear it’s working now for you :slight_smile: