Skip to content

Gunicorn error TypeError: 'NoneType' object does not support item assignment #298

@MoralCode

Description

@MoralCode

This happened on first startup, it seemed like gunicorn failed to start, and then started up immediately after.

after the failure, there were lines in the log about unexpected EOF on open transaction or something? maybe theres a race condition at startup that is the cause of the weird transaction errors in other issues that have been filed ~recently

Stack Trace
[2026-05-05 23:31:58 +0000] [408] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/collectoss/collectoss/api/view/utils.py", line 51, in loadSettings
    cachePath.mkdir(parents=True)
  File "/usr/local/lib/python3.11/pathlib.py", line 1116, in mkdir
    os.mkdir(self, mode)
FileExistsError: [Errno 17] File exists: '/collectoss/collectoss/static/cache'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
    worker.init_process()
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
                ^^^^^^^^^^^^^^^
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
                    ^^^^^^^^^^^
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
           ^^^^^^^^^^^^^^^^^^^
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/util.py", line 371, in import_app
    mod = importlib.import_module(module)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/collectoss/collectoss/api/server.py", line 731, in <module>
    from .view.api_view import *
  File "/collectoss/collectoss/api/view/api_view.py", line 4, in <module>
    from .utils import *
  File "/collectoss/collectoss/api/view/utils.py", line 69, in <module>
    loadSettings()
  File "/collectoss/collectoss/api/view/utils.py", line 54, in loadSettings
    raise Exception(f"Cannot initialize caching: could not create cache directory [{cachePath}]")
Exception: Cannot initialize caching: could not create cache directory [/collectoss/collectoss/static/cache]
[2026-05-05 23:31:58 +0000] [408] [INFO] Worker exiting (pid: 408)
[2026-05-05 23:31:58 +0000] [339] [ERROR] Worker (pid:407) exited with code 3
[2026-05-05 23:37:44 +0000] [339] [INFO] Starting gunicorn 22.0.0
[2026-05-05 23:37:44 +0000] [339] [INFO] Listening at: http://0.0.0.0:5000 (339)
[2026-05-05 23:37:44 +0000] [339] [INFO] Using worker: sync
[2026-05-05 23:37:44 +0000] [403] [INFO] Booting worker with pid: 403
[2026-05-05 23:37:44 +0000] [404] [INFO] Booting worker with pid: 404
[2026-05-05 23:37:44 +0000] [405] [INFO] Booting worker with pid: 405
[2026-05-05 23:37:44 +0000] [406] [INFO] Booting worker with pid: 406
[2026-05-05 23:37:44 +0000] [407] [INFO] Booting worker with pid: 407
[2026-05-05 23:37:44 +0000] [408] [INFO] Booting worker with pid: 408
[2026-05-05 23:37:45 +0000] [405] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/arbiter.py", line 609, in spawn_worker
    worker.init_process()
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
                ^^^^^^^^^^^^^^^
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
                    ^^^^^^^^^^^
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
           ^^^^^^^^^^^^^^^^^^^
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/collectoss/.venv/lib/python3.11/site-packages/gunicorn/util.py", line 371, in import_app
    mod = importlib.import_module(module)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/collectoss/collectoss/api/server.py", line 731, in <module>
    from .view.api_view import *
  File "/collectoss/collectoss/api/view/api_view.py", line 4, in <module>
    from .utils import *
  File "/collectoss/collectoss/api/view/utils.py", line 69, in <module>
    loadSettings()
  File "/collectoss/collectoss/api/view/utils.py", line 57, in loadSettings
    settings["caching"] = cachePath
    ~~~~~~~~^^^^^^^^^^^
TypeError: 'NoneType' object does not support item assignment

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