Cannot convert from JSON to MongoDB #2251

Closed
opened 2018-10-16 22:07:58 +02:00 by laggron42 · 3 comments
laggron42 commented 2018-10-16 22:07:58 +02:00 (Migrated from github.com)

Other bugs

What were you trying to do?

Edit an instance to modify its storage type from JSON to MongoDB.

What were you expecting to happen?

Convert the JSON data to the MongoDB scheme.

What actually happened?

Please choose your storage backend (if you re unsure, choose 1).
1. JSON (file storage, requires no database).
2. MongoDB
> 2
Enter URI scheme (mongodb or mongodb+srv): mongodb
Enter host address: 127.0.0.1:27017
Enter login username:
Enter login password:
Enter mongodb database name: Oxibot
Would you like to import your data? (y/n) y
Traceback (most recent call last):
  File "/usr/local/bin/redbot-setup", line 11, in <module>
    load_entry_point('Red-DiscordBot==3.0.0rc2', 'console_scripts', 'redbot-setup')()
  File "/usr/local/lib/python3.6/dist-packages/redbot/setup.py", line 384, in main
    loop.run_until_complete(edit_instance())
  File "/usr/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.6/dist-packages/redbot/setup.py", line 278, in edit_instance
    await json_to_mongo(current_data_dir, storage_details)
  File "/usr/local/lib/python3.6/dist-packages/redbot/setup.py", line 198, in json_to_mongo
    {"_id": cog_m.unique_cog_identifier}, update={"$set": cog_data[cog_i]}, upsert=True
KeyError: '-4851999857783813997'

How can we reproduce this issue?

According to Crossedfall, this seems to happen with 3rd party cogs, but I can't give more details, the error does not details which file the bot was editing, and there's no logger in redbot-setup.

# Other bugs <!-- Did you find a bug with something other than a command? Fill out the following: --> #### What were you trying to do? <!-- Replace this line with a description of what you were trying to do --> Edit an instance to modify its storage type from JSON to MongoDB. #### What were you expecting to happen? <!-- Replace this line with a description of what you were expecting to happen --> Convert the JSON data to the MongoDB scheme. #### What actually happened? <!-- Replace this line with a description of what actually happened. Include any error messages --> ```py Please choose your storage backend (if you re unsure, choose 1). 1. JSON (file storage, requires no database). 2. MongoDB > 2 Enter URI scheme (mongodb or mongodb+srv): mongodb Enter host address: 127.0.0.1:27017 Enter login username: Enter login password: Enter mongodb database name: Oxibot Would you like to import your data? (y/n) y Traceback (most recent call last): File "/usr/local/bin/redbot-setup", line 11, in <module> load_entry_point('Red-DiscordBot==3.0.0rc2', 'console_scripts', 'redbot-setup')() File "/usr/local/lib/python3.6/dist-packages/redbot/setup.py", line 384, in main loop.run_until_complete(edit_instance()) File "/usr/lib/python3.6/asyncio/base_events.py", line 467, in run_until_complete return future.result() File "/usr/local/lib/python3.6/dist-packages/redbot/setup.py", line 278, in edit_instance await json_to_mongo(current_data_dir, storage_details) File "/usr/local/lib/python3.6/dist-packages/redbot/setup.py", line 198, in json_to_mongo {"_id": cog_m.unique_cog_identifier}, update={"$set": cog_data[cog_i]}, upsert=True KeyError: '-4851999857783813997' ``` #### How can we reproduce this issue? <!-- Replace with numbered steps to reproduce the issue --> According to Crossedfall, this seems to happen with 3rd party cogs, but I can't give more details, the error does not details which file the bot was editing, and there's no logger in `redbot-setup`.
sleepymanakete commented 2018-11-15 21:31:08 +01:00 (Migrated from github.com)

I am getting an error similar to the one above doing the same steps.

  File "/home/lailah/bots/bin/redbot-setup", line 11, in <module>
    load_entry_point('Red-DiscordBot==3.0.0rc2', 'console_scripts',
'redbot-setup')()
  File "/home/lailah/bots/lib/python3.6/site-packages/redbot/setup.py",
line 384, in main
    loop.run_until_complete(edit_instance())
  File "/usr/lib/python3.6/asyncio/base_events.py", line 468, in
run_until_complete
    return future.result()
  File "/home/lailah/bots/lib/python3.6/site-packages/redbot/setup.py",
line 278, in edit_instance
    await json_to_mongo(current_data_dir, storage_details)
  File "/home/lailah/bots/lib/python3.6/site-packages/redbot/setup.py",
line 198, in json_to_mongo
    {"_id": cog_m.unique_cog_identifier}, update={"$set":
cog_data[cog_i]}, upsert=True
KeyError: '-2039828293'```
I am getting an error similar to the one above doing the same steps. ```Traceback (most recent call last): File "/home/lailah/bots/bin/redbot-setup", line 11, in <module> load_entry_point('Red-DiscordBot==3.0.0rc2', 'console_scripts', 'redbot-setup')() File "/home/lailah/bots/lib/python3.6/site-packages/redbot/setup.py", line 384, in main loop.run_until_complete(edit_instance()) File "/usr/lib/python3.6/asyncio/base_events.py", line 468, in run_until_complete return future.result() File "/home/lailah/bots/lib/python3.6/site-packages/redbot/setup.py", line 278, in edit_instance await json_to_mongo(current_data_dir, storage_details) File "/home/lailah/bots/lib/python3.6/site-packages/redbot/setup.py", line 198, in json_to_mongo {"_id": cog_m.unique_cog_identifier}, update={"$set": cog_data[cog_i]}, upsert=True KeyError: '-2039828293'```
Kowlin commented 2018-12-20 02:19:58 +01:00 (Migrated from github.com)

Can confirm that this is an issue.

Can confirm that this is an issue.
Tobotimus commented 2018-12-29 00:51:47 +01:00 (Migrated from github.com)

Resolved by #2346.

Resolved by #2346.
Sign in to join this conversation.
No labels
Automated PR
Blocked
Blocked By: Damage Control
Blocked By: Dependency
Blocked By: Other PR
Breaking Change
Category: CI
Category: Cogs - Admin
Category: Cogs - Alias
Category: Cogs - Audio
Category: Cogs - Bank
Category: Cogs - Cleanup
Category: Cogs - CustomCommands
Category: Cogs - Dev
Category: Cogs - Downloader
Category: Cogs - Economy
Category: Cogs - Filter
Category: Cogs - General
Category: Cogs - Image
Category: Cogs - Mod
Category: Cogs - Modlog
Category: Cogs - Mutes
Category: Cogs - Permissions
Category: Cogs - Reports
Category: Cogs - Streams
Category: Cogs - Trivia
Category: Cogs - Trivia - Lists
Category: Cogs - Warnings
Category: Core - API - App Commands Package
Category: Core - API - Audio
Category: Core - API - Bank
Category: Core - API - Commands Package
Category: Core - API - Config
Category: Core - API - Other
Category: Core - API - Utils Package
Category: Core - Bot Class
Category: Core - Bot Commands
Category: Core - Command-line Interfaces
Category: Core - Downloader
Category: Core - Help
Category: Core - i18n
Category: Core - Modlog
Category: Core - Other Internals
Category: Core - RPC/ZMQ
Category: Docker
Category: Docs - Changelogs
Category: Docs - For Developers
Category: Docs - Install Guides
Category: Docs - Other
Category: Docs - User Guides
Category: Meta
Category: RPC/ZMQ methods
Category: Vendored Packages
Changelog Entry: Added
Changelog Entry: Pending
Changelog Entry: Skipped
Closed: Duplicate
Closed: External
Closed: Invalid
Closed: User Error
Closed: Won't Fix
Complex Issue
Docs-only
Feature Branch
Good First Issue
Help Wanted
High Priority
Needs Backport To stable-docs
No Activity
No Repro
QA: Bypassed
QA: Changes Requested
QA: Passed
Release Blocker
Status: Accepted
Status: Frozen
Status: In Progress
Status: Needs Discussion
Status: Needs Info
Status: Needs Triage
Status: PRs Welcome
Type: Bug
Type: Dependency Update
Type: Deprecation
Type: Enhancement
Type: Feature
Type: Informational
Type: Merge
Type: Optimisation
Type: Question
Type: Removal
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Mrcoolgamer11/Red-DiscordBot#2251
No description provided.