Skip to content

[Bug]: Guardrail: patterns lost on edit or mode toggle #19084

@mArIa-cloud-dot

Description

@mArIa-cloud-dot

What happened?

Adding a pattern or toggling mode then saving causes the custom regex list to be cleared on persist/reload.

Custom regex patterns in a Guardrail (pre_call mode, Provider: LiteLLM Content-Filter) are removed or reset when editing patterns (add/modify) or when toggling the guardrail mode between "mask" and "block" and saving.

All custom regex patterns and guardrail settings persist after saving, regardless of adding/modifying patterns or toggling between "mask" and "block"

Steps to Reproduce

  1. Open LiteLLM UI → Guardrails / Policy editor.
  2. Select an existing guardrail that contains custom regex patterns (confirm patterns are present).
  3. Path A — Add/Modify pattern:
    • Add a new custom regex pattern or edit an existing one.
    • Click Save.
    • Reopen the guardrail → observe whether the new/modified pattern persisted.
  4. Path B — Toggle mode:
    • Change representation from maskblock.
    • Click Save.
    • Reopen the guardrail → observe whether original patterns remain.
  5. Path C — Combined:
    • Add a pattern, toggle mode, Save, then Reopen → check persisted patterns.

Relevant log output

What part of LiteLLM is this about?

SDK (litellm Python package)

What LiteLLM version are you on ?

V1.80.11

Twitter / LinkedIn details

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinguiui-dashboardIssues related to the LiteLLM UI Dashboard

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions