# \[Solved\] Context deadline exceeded error when doing mmctl import

**URL:** <https://forum.mattermost.com/t/solved-context-deadline-exceeded-error-when-doing-mmctl-import/22240>\
**Category:** Command Line Interface\
**Created:** [January 17, 2025, 8:46am UTC](https://forum.mattermost.com/t/solved-context-deadline-exceeded-error-when-doing-mmctl-import/22240 "2025-01-17T08:46:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![hadifarnoud](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/hadifarnoud/32/8639_2.png) [@hadifarnoud](https://forum.mattermost.com/u/hadifarnoud)\
**Post date:** [January 17, 2025, 8:46am UTC](https://forum.mattermost.com/t/solved-context-deadline-exceeded-error-when-doing-mmctl-import/22240/1 "2025-01-17T08:46:31Z")

</div>

I cannot get mmctl import to work.

```auto
mmctl --local import upload ./mattermost-bulk-import.zip
Error: failed to upload data: : Unable to write the file., 
unable write the data in the file import/m1tmnrw7d ****8f1p3ct7a9h_mattermost-bulk-import.zip.tmp: Put "https://****** /kamva-chat/import/m1tmnrw7dbdxfq38f1p3ct7a9h_mattermost-bulk-import.zip.tmp?partNumber=204&uploadId= ***** TysJwdyxltqcPnxVAzA79JryjG": 
context deadline exceeded

```

I tried everything. I changed the body size limit to 5G. I changed Read Timeout and Write Timeout to 3600. I tried local and remote import. neither works and both throw same error.

any idea what is wrong?

---

<div class="post-metadata">

**Author:** ![hadifarnoud](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/hadifarnoud/32/8639_2.png) [@hadifarnoud](https://forum.mattermost.com/u/hadifarnoud)\
**Post date:** [January 17, 2025, 9:28am UTC](https://forum.mattermost.com/t/solved-context-deadline-exceeded-error-when-doing-mmctl-import/22240/2 "2025-01-17T09:28:39Z")

</div>

the validate output:

```auto
root@racknerd-00fbbd:~# ./mmctl import validate ./mattermost-bulk-import.zip
WARNING: server version 9.3.0.7014621505.1541b4eabce3bb7bd2ff469b044c9d35.false doesn't match mmctl version 8.0.0
The .jsonl file has 60713 lines
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:9439 field "post.attachments[0]": missing attachment file "data/bulk-export-attachments/FRLQPHQB0_VID_20191211_113612.MOV"
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:13175 field "post.attachments[0]": missing attachment file "data/bulk-export-attachments/F9U5FA431_Happy_Nowruz.MOV"
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:14205 field "post": BulkImport: app.import.validate_post_import_data.message_length.error
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:14457 field "post": BulkImport: app.import.validate_post_import_data.message_length.error
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:14655 field "post": BulkImport: app.import.validate_post_import_data.message_length.error
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:14772 field "post.attachments[0]": missing attachment file "data/bulk-export-attachments/FFQ58GTHT_IMG_1920.MOV"
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:14873 field "post": BulkImport: app.import.validate_post_import_data.message_length.error
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:15171 field "post": BulkImport: app.import.validate_post_import_data.message_length.error
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:15216 field "post.attachments[0]": missing attachment file "data/bulk-export-attachments/FKP49U9N2_IMG_2331.MOV"
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:32749 field "post": BulkImport: app.import.validate_post_import_data.message_length.error
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:37580 field "post": BulkImport: app.import.validate_post_import_data.message_length.error
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:41331 field "post": BulkImport: app.import.validate_post_import_data.message_length.error
import validation error in mattermost-bulk-import.zip->mattermost_import.jsonl:59797 field "post": BulkImport: app.import.validate_post_import_data.message_length.error
Progress: 60713/60713 (100.00%)
Schemes 0
Teams 0
Channels 33
Users 113
Emojis 0
Posts 60566
Direct Channels 0
Direct Posts 0
Attachments 2236
Unused Attachments (535):
  data/bulk-export-attachments/ ****

It took 1.962112455s to validate 60713 lines in ./mattermost-bulk-import.zip
Validation complete

```

I highly doubt this is the reason but included this anyway

---

<div class="post-metadata">

**Author:** ![hadifarnoud](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/hadifarnoud/32/8639_2.png) [@hadifarnoud](https://forum.mattermost.com/u/hadifarnoud)\
**Post date:** [January 17, 2025, 10:56am UTC](https://forum.mattermost.com/t/solved-context-deadline-exceeded-error-when-doing-mmctl-import/22240/3 "2025-01-17T10:56:40Z")

</div>

log

```auto
error web/context.go:115 timestamp=2025-01-17 10:25:51.762 Z path=/api/v4/uploads/y9kwqmeuu78i3edfmyzxtqfoae request_id=5su6113ag7d7zkgqjzdafwyr1c ip_addr= *****user_id=j7xhmcfmatnrugu3yiekkru15c method=POST err_where=WriteFile http_code=500 error=WriteFile: Unable to write the file., unable write the data in the file import/y9kwqmeuu78i3edfmyzxtqfoae_mattermost-bulk-import.zip.tmp: Put "https://****** / ****/import/y9kwqmeuu78i3edfmyzxtqfoae_mattermost-bulk-import.zip.tmp?partNumber=319&uploadId=2~*****": context deadline exceeded Unable to write the file.

```

---

<div class="post-metadata">

**Author:** ![hadifarnoud](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/hadifarnoud/32/8639_2.png) [@hadifarnoud](https://forum.mattermost.com/u/hadifarnoud)\
**Post date:** [January 17, 2025, 1:10pm UTC](https://forum.mattermost.com/t/solved-context-deadline-exceeded-error-when-doing-mmctl-import/22240/4 "2025-01-17T13:10:11Z")

</div>

updating to 10.3.2 fixed the issue of uploading the file.

I now have a different issue:

```auto
[
  {
    "id": "s5n19ogdn7dhiy9gnssarf3wya",
    "type": "import_process",
    "priority": 0,
    "create_at": 1737119304306,
    "start_at": 1737119311194,
    "last_activity_at": 1737119312525,
    "status": "error",
    "progress": -1,
    "data": {
      "error": "Error during job execution. — UpdateUserRoles: Cannot demote last System Admin.",
      "import_file": "x153b9iqhfdmdy77qjsqgmt7ae_mattermost-bulk-import.zip",
      "line_number": "45"
    }
  }
]

```

---

<div class="post-metadata">

**Author:** ![hadifarnoud](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/hadifarnoud/32/8639_2.png) [@hadifarnoud](https://forum.mattermost.com/u/hadifarnoud)\
**Post date:** [January 17, 2025, 3:21pm UTC](https://forum.mattermost.com/t/solved-context-deadline-exceeded-error-when-doing-mmctl-import/22240/5 "2025-01-17T15:21:46Z")

</div>

I fixed this with adding a new admin. there were other minor errors but managed to fix them all
