IssueMatch icon indicating copy to clipboard operation
IssueMatch copied to clipboard

[BUG] extra keys configured in .env

Open kalikaruto opened this issue 1 year ago • 1 comments

Prerequisites

  • [x] I have searched existing issues to ensure this bug hasn't been reported before
  • [x] I have updated to the latest version of the project
  • [x] I have read the troubleshooting documentation

🔍 Bug Description

There are OPENAI_API_KEY and SENTRY_DSN extra/ optional keys in the .env.example and this project is using pydantic v2 which does not allow these empty (or optional) keys.

🔄 Steps to Reproduce

followed the instructions to start the bakend from the README.md file except put the OPENAI_API_KEY and SENTRY_DSN as empty

✅ Expected Behavior

pydantic should ignore the empty keys (which it does not do in default)

❌ Actual Behavior

pydantic raises an error about extra variables (empty) in .env (a copy of .env.example)

🚨 Severity

Low - Minor issue, workaround available

🖥️ Environment Information

OS: Arch
Browser: Brave
but this is specific to pydantic so its not the system

📋 Error Logs

Process SpawnProcess-2:
Traceback (most recent call last):
  File "/usr/lib/python3.13/multiprocessing/process.py", line 313, in _bootstrap
    self.run()
    ~~~~~~~~^^
  File "/usr/lib/python3.13/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/karuto/PROJECTS/osci/IssueMatch-osci/backend/venv/lib/python3.13/site-packages/uvicorn/_subprocess.py", line 78, in subprocess_started
    target(sockets=sockets)
    ~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/karuto/PROJECTS/osci/IssueMatch-osci/backend/venv/lib/python3.13/site-packages/uvicorn/server.py", line 65, in run
    return asyncio.run(self.serve(sockets=sockets))
           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/asyncio/runners.py", line 195, in run
    return runner.run(main)
           ~~~~~~~~~~^^^^^^
  File "/usr/lib/python3.13/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "uvloop/loop.pyx", line 1518, in uvloop.loop.Loop.run_until_complete
  File "/home/karuto/PROJECTS/osci/IssueMatch-osci/backend/venv/lib/python3.13/site-packages/uvicorn/server.py", line 69, in serve
    await self._serve(sockets)
  File "/home/karuto/PROJECTS/osci/IssueMatch-osci/backend/venv/lib/python3.13/site-packages/uvicorn/server.py", line 76, in _serve
    config.load()
    ~~~~~~~~~~~^^
  File "/home/karuto/PROJECTS/osci/IssueMatch-osci/backend/venv/lib/python3.13/site-packages/uvicorn/config.py", line 433, in load
    self.loaded_app = import_from_string(self.app)
                      ~~~~~~~~~~~~~~~~~~^^^^^^^^^^
  File "/home/karuto/PROJECTS/osci/IssueMatch-osci/backend/venv/lib/python3.13/site-packages/uvicorn/importer.py", line 19, in import_from_string
    module = importlib.import_module(module_str)
  File "/usr/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/karuto/PROJECTS/osci/IssueMatch-osci/backend/app/main.py", line 6, in <module>
    from .core.config import settings
  File "/home/karuto/PROJECTS/osci/IssueMatch-osci/backend/app/core/config.py", line 29, in <module>
    settings = Settings()
  File "/home/karuto/PROJECTS/osci/IssueMatch-osci/backend/venv/lib/python3.13/site-packages/pydantic_settings/main.py", line 84, in __init__
    super().__init__(
    ~~~~~~~~~~~~~~~~^
        **__pydantic_self__._settings_build_values(
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
        )
        ^
    )
    ^
  File "/home/karuto/PROJECTS/osci/IssueMatch-osci/backend/venv/lib/python3.13/site-packages/pydantic/main.py", line 253, in __init__
    validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
pydantic_core._pydantic_core.ValidationError: 6 validation errors for Settings
DATABASE_URL
  Extra inputs are not permitted [type=extra_forbidden, input_value='postgresql://user:passwo...host:5432/issuematch_db', input_type=str]
    For further information visit https://errors.pydantic.dev/2.11/v/extra_forbidden
BACKEND_HOST
  Extra inputs are not permitted [type=extra_forbidden, input_value='127.0.0.1', input_type=str]
    For further information visit https://errors.pydantic.dev/2.11/v/extra_forbidden
BACKEND_PORT
  Extra inputs are not permitted [type=extra_forbidden, input_value='8000', input_type=str]
    For further information visit https://errors.pydantic.dev/2.11/v/extra_forbidden
OPENAI_API_KEY
  Extra inputs are not permitted [type=extra_forbidden, input_value='# optional: if using OpenAI for embeddings', input_type=str]
    For further information visit https://errors.pydantic.dev/2.11/v/extra_forbidden
REDIS_URL
  Extra inputs are not permitted [type=extra_forbidden, input_value='redis://localhost:6379/0', input_type=str]
    For further information visit https://errors.pydantic.dev/2.11/v/extra_forbidden
SENTRY_DSN
  Extra inputs are not permitted [type=extra_forbidden, input_value='# optional: add if using Sentry', input_type=str]
    For further information visit https://errors.pydantic.dev/2.11/v/extra_forbidden

📸 Screenshots

No response

📝 Additional Context

No response

🤝 Contribution

  • [x] I'm willing to submit a pull request to fix this bug
  • [x] I can help with testing the fix
  • [x] I'm available to provide additional information if needed

kalikaruto avatar Aug 25 '25 18:08 kalikaruto

Thank you for raising this issue!

We'll review it as soon as possible. We truly appreciate your contributions! ✨

Meanwhile make sure you've visited the README.md, CONTRIBUTING.md, and CODE_OF_CONDUCT.md before creating a PR for this. Also, please do NOT create a PR until this issue has been assigned to you. 😊

github-actions[bot] avatar Aug 25 '25 18:08 github-actions[bot]