Skip to content

BUG: Backend fails to start on fresh install due to Discord dependency mismatch #185

@adot-7

Description

@adot-7

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

Following INSTALL_GUIDE.md for a fresh setup causes the backend to crash during startup while initializing the Discord bot.

Steps to Reproduce

  1. Clone the repository and cd into the directory
  2. Follow INSTALL_GUIDE.md exactly
  3. After running poetry run python main.py, the following error is noticed:
2025-12-14 08:01:46,003 - app.core.orchestration.queue_manager - INFO - Registered handler for message type: devrel_request
2025-12-14 08:01:46,004 - app.core.orchestration.queue_manager - INFO - Registered handler for message type: clear_thread_memory
2025-12-14 08:01:46,006 - app.core.orchestration.queue_manager - INFO - Registered handler for message type: discord_response
INFO:     Will watch for changes in these directories: ['/home/adot/projects/hackathon_contributions/Devr.AI/backend']
INFO:     Uvicorn running on http://0.0.0.0:8000 (Press CTRL+C to quit)
INFO:     Started reloader process [275668] using StatReload
2025-12-14 08:01:50,705 - app.core.orchestration.queue_manager - INFO - Registered handler for message type: devrel_request
2025-12-14 08:01:50,705 - app.core.orchestration.queue_manager - INFO - Registered handler for message type: clear_thread_memory
2025-12-14 08:01:50,707 - app.core.orchestration.queue_manager - INFO - Registered handler for message type: discord_response
/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/websockets/legacy/__init__.py:6: DeprecationWarning: websockets.legacy is deprecated; see https://websockets.readthedocs.io/en/stable/howto/upgrade.html for upgrade instructions
  warnings.warn(  # deprecated in 14.0 - 2024-11-09
/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/uvicorn/protocols/websockets/websockets_impl.py:17: DeprecationWarning: websockets.server.WebSocketServerProtocol is deprecated
  from websockets.server import WebSocketServerProtocol
INFO:     Started server process [275740]
INFO:     Waiting for application startup.
2025-12-14 08:01:50,732 - __mp_main__ - INFO - Starting background tasks (Discord Bot & Queue Manager)...
2025-12-14 08:01:50,748 - httpx - INFO - HTTP Request: GET http://localhost:8080/v1/.well-known/openid-configuration "HTTP/1.1 404 Not Found"
2025-12-14 08:01:50,756 - httpx - INFO - HTTP Request: GET http://localhost:8080/v1/meta "HTTP/1.1 200 OK"
2025-12-14 08:01:51,103 - httpx - INFO - HTTP Request: GET https://pypi.org/pypi/weaviate-client/json "HTTP/1.1 200 OK"
2025-12-14 08:01:51,149 - httpx - INFO - HTTP Request: GET http://localhost:8080/v1/.well-known/ready "HTTP/1.1 200 OK"
2025-12-14 08:01:51,149 - __mp_main__ - INFO - Weaviate connection successful and ready
2025-12-14 08:01:51,169 - app.core.orchestration.queue_manager - INFO - Successfully connected to RabbitMQ
2025-12-14 08:01:51,169 - app.core.orchestration.queue_manager - INFO - Started 3 async queue workers
2025-12-14 08:01:51,171 - __mp_main__ - ERROR - Error during background task startup: module 'discord.ext.commands' has no attribute 'ExtensionError'
Traceback (most recent call last):
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/cog.py", line 784, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/adot/projects/hackathon_contributions/Devr.AI/backend/integrations/discord/cogs.py", line 4, in <module>
    from discord import app_commands
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/app_commands/__init__.py", line 12, in <module>
    from .commands import *
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/app_commands/commands.py", line 51, in <module>
    from ..enums import AppCommandOptionType, AppCommandType, ChannelType, Locale
ImportError: cannot import name 'AppCommandOptionType' from 'discord.enums' (/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/enums.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/adot/projects/hackathon_contributions/Devr.AI/backend/main.py", line 50, in start_background_tasks
    await self.discord_bot.load_extension("integrations.discord.cogs")
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/cog.py", line 918, in load_extension
    self._load_from_module_spec(spec, name)
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/cog.py", line 787, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'integrations.discord.cogs' raised an error: ImportError: cannot import name 'AppCommandOptionType' from 'discord.enums' (/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/enums.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/adot/projects/hackathon_contributions/Devr.AI/backend/main.py", line 51, in start_background_tasks
    except (ImportError, commands.ExtensionError) as e:
AttributeError: module 'discord.ext.commands' has no attribute 'ExtensionError'. Did you mean: 'ConversionError'?
2025-12-14 08:01:51,176 - __mp_main__ - INFO - Stopping background tasks and closing connections...
2025-12-14 08:01:51,176 - __mp_main__ - INFO - Discord bot has been closed.
2025-12-14 08:01:51,177 - app.core.orchestration.queue_manager - INFO - Stopped all queue workers and closed connection
2025-12-14 08:01:51,178 - __mp_main__ - INFO - Queue manager has been stopped.
2025-12-14 08:01:51,178 - __mp_main__ - INFO - All background tasks and connections stopped.
ERROR:    Traceback (most recent call last):
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/cog.py", line 784, in _load_from_module_spec
    spec.loader.exec_module(lib)  # type: ignore
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/adot/projects/hackathon_contributions/Devr.AI/backend/integrations/discord/cogs.py", line 4, in <module>
    from discord import app_commands
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/app_commands/__init__.py", line 12, in <module>
    from .commands import *
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/app_commands/commands.py", line 51, in <module>
    from ..enums import AppCommandOptionType, AppCommandType, ChannelType, Locale
ImportError: cannot import name 'AppCommandOptionType' from 'discord.enums' (/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/enums.py)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/adot/projects/hackathon_contributions/Devr.AI/backend/main.py", line 50, in start_background_tasks
    await self.discord_bot.load_extension("integrations.discord.cogs")
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/cog.py", line 918, in load_extension
    self._load_from_module_spec(spec, name)
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/cog.py", line 787, in _load_from_module_spec
    raise errors.ExtensionFailed(key, e) from e
discord.errors.ExtensionFailed: Extension 'integrations.discord.cogs' raised an error: ImportError: cannot import name 'AppCommandOptionType' from 'discord.enums' (/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/discord/enums.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/starlette/routing.py", line 692, in lifespan
    async with self.lifespan_context(app) as maybe_state:
  File "/home/adot/.pyenv/versions/3.10.19/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/home/adot/.cache/pypoetry/virtualenvs/devr-ai-lttTo2q8-py3.10/lib/python3.10/site-packages/fastapi/routing.py", line 133, in merged_lifespan
    async with original_context(app) as maybe_original_state:
  File "/home/adot/.pyenv/versions/3.10.19/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/home/adot/projects/hackathon_contributions/Devr.AI/backend/main.py", line 100, in lifespan
    await app_instance.start_background_tasks()
  File "/home/adot/projects/hackathon_contributions/Devr.AI/backend/main.py", line 51, in start_background_tasks
    except (ImportError, commands.ExtensionError) as e:
AttributeError: module 'discord.ext.commands' has no attribute 'ExtensionError'. Did you mean: 'ConversionError'?

ERROR:    Application startup failed. Exiting.
sys:1: ResourceWarning: unclosed file <_io.TextIOWrapper name=0 mode='r' encoding='UTF-8'>

Expected Behavior

The backend should start without any errors

Record

  • I agree to follow this project's Code of Conduct
  • I want to work on this issue

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions