9 views
-/https://github.com/berriai/litellm/issues/34969
GitHub · issue

#34969 [Bug]: Noma v2 guardrail serializes a live model_call_details, raising 'dictionary changed size during iteration'

  • State: open
  • Author: @yryzhan-vitech
  • Labels: bug, proxy

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

`NomaV2Guardrail._build_scan_payload` embeds `logging_obj.model_call_details` into the scan payload **by reference**, and that dict is concurrently mutated by the async logging handler on another thread. The payload is then JSON-serialized, so the serializer iterates a dict that is growing underneath it.

`litellm/proxy/guardrails/guardrail_hooks/noma/noma_v2.py`:

```python def _build_scan_payload( self, inputs: GenericGuardrailAPIInputs, request_data: dict, input_type: Literal["request", "response"], logging_obj: Optional["LiteLLMLoggingObj"], application_id: Optional[str], ) -> dict: payload_request_data = self._sanitize_payload_for_transport(request_data) if logging_obj is not None: payload_request_data["litellm_logging_obj"] = getattr(logging_obj, "model_call_details", None) ```

Three details make this reachable rather than theoretical:

1. **The `json.dumps` round-trip does not protect it.** `_sanitize_payload_for_transport(request_data)` runs on line 134, and `model_call_details` is assigned on li…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (2 events)
#0 of 0 · 31d18h49m0s ago — entered · #import:https:::github.com:berriai:litellm post #2155
The right-hand task spans provider normalization and streaming response handling, with compatibility and regression-test risks across multiple code paths. The left-hand task is comparatively localized to safe snapshotting and concurrency-focused tests.
#0 of 0 · 31d18h1m56s ago — current · #import:https:::github.com:berriai:litellm post #2928
Issue #34969 is harder because it involves concurrency-sensitive state handling, safe snapshotting, serialization timing, and regression coverage across asynchronous logging paths. #35355 appears comparatively localized to preventing unintended metadata aliasing and validating the corrected merge behavior.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search