#4617·litestar

错误: 使用 structlog 的 KeyValueRenderer 会在每条消息中引发错误

作者: xeals创建于 2026年3月1日更新于 2026年9月30日
标签Bug :bug:

ERROR: An exception occurred in the ASGI application Traceback (most recent call last): File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/litestar/middleware/_internal/exceptions/middleware.py", line 158, in __call__ await self.app(scope, receive, capture_response_started) File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/litestar/_asgi/asgi_router.py", line 100, in __call__ await asgi_app(scope, receive, send) File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/litestar/middleware/base.py", line 147, in wrapped_call await original__call__(self, scope, receive, send) # pyright: ignore File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/litestar/middleware/logging.py", line 110, in __call__ await self.log_request(scope=scope, receive=receive) File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/litestar/middleware/logging.py", line 125, in log_request self.log_message(values=extracted_data) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/litestar/middleware/logging.py", line 150, in log_message self.logger.info(message, **values) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszxr-dev-env/lib/python3.13/site-packages/structlog/_native.py", line 16 4, in meth return self._proxy_to_logger( ~~~~~~~~~~~~~~~~~~~~~^ name, _maybe_interpolate(event, args), **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/nix/store/ggwbxm2ambk0ihill7r12c8vvjsiszx

内容来源: litestar-org/litestar