Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rocketchat migration KeyError: 'username' #419

Closed
zbajor1 opened this issue Dec 12, 2023 · 2 comments
Closed

rocketchat migration KeyError: 'username' #419

zbajor1 opened this issue Dec 12, 2023 · 2 comments

Comments

@zbajor1
Copy link

zbajor1 commented Dec 12, 2023

Hello,

i am trying to convert rocketchat data but have error message :

Converting Data ...
Traceback (most recent call last):
File "./manage.py", line 150, in
execute_from_command_line(sys.argv)
File "./manage.py", line 115, in execute_from_command_line
utility.execute()
File "/srv/zulip-venv-cache/91891b485c66dcf1dcb5c01dcf020d982a39839d/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/init.py", line 436, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/srv/zulip-venv-cache/91891b485c66dcf1dcb5c01dcf020d982a39839d/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 412, in run_from_argv
self.execute(*args, **cmd_options)
File "/srv/zulip-venv-cache/91891b485c66dcf1dcb5c01dcf020d982a39839d/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 458, in execute
output = self.handle(*args, **options)
File "/home/zulip/deployments/2023-11-17-14-00-06/zerver/management/commands/convert_rocketchat_data.py", line 45, in handle
do_convert_data(rocketchat_data_dir=data_dir, output_dir=output_dir)
File "/home/zulip/deployments/2023-11-17-14-00-06/zerver/data_import/rocketchat.py", line 1066, in do_convert_data
username_to_user_id_map: Dict[str, str] = map_username_to_user_id(user_id_to_user_map)
File "/home/zulip/deployments/2023-11-17-14-00-06/zerver/data_import/rocketchat.py", line 971, in map_username_to_user_id
username_to_user_id_map[user_dict["username"]] = user_id
KeyError: 'username'

anyone to give a help ?

Best regards

@someadmin
Copy link

someadmin commented Mar 28, 2024

Hello,
I got a similar issue, trying to convert data exported from rocketchat with mongodump -o "path" command inside the zulip container:

cec005526bd0:~/deployments/current$ ./manage.py convert_rocketchat_data /tmp/dump/rocketchat/ --output /tmp/converted_rocketchat_data
Converting Data ...
Traceback (most recent call last):
File "./manage.py", line 157, in
execute_from_command_line(sys.argv)
File "./manage.py", line 122, in execute_from_command_line
utility.execute()
File "/srv/zulip-venv-cache/726c7d1d35d9cd61bb4b70e98167a1db7b0c524d/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/srv/zulip-venv-cache/726c7d1d35d9cd61bb4b70e98167a1db7b0c524d/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/srv/zulip-venv-cache/726c7d1d35d9cd61bb4b70e98167a1db7b0c524d/zulip-py3-venv/lib/python3.8/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/home/zulip/deployments/2022-03-29-17-46-36/zerver/management/commands/convert_rocketchat_data.py", line 45, in handle
do_convert_data(rocketchat_data_dir=data_dir, output_dir=output_dir)
File "/home/zulip/deployments/2022-03-29-17-46-36/zerver/data_import/rocketchat.py", line 940, in do_convert_data
realm = make_realm(realm_id, realm_subdomain, domain_name, rocketchat_data["instance"][0])
IndexError: list index out of range

Initially after mongodump -o /tmp/dump i got 3 folders in "dump", and one of them is "rocketchat", that obviously contains rocketchat data as .bson files.

Can anyone, please, clarify is it my fault during mongodump or convertion script bug?

@timabbott
Copy link
Member

I believe these bugs were fixed in Zulip 9.0. In general, for import tool issues, you should ask for help in https://zulip.com/development-community/, since it often really helps to coordinate more closely with your data. Rocket.Chat exports/database dumps are from MongoDB, which is schemaless, and sometimes there's corrupted data in it as a result.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants