You set up custom regex patterns in a Content Filter guardrail, save it, then later toggle the mode (mask ↔ block) or make a small edit - and suddenly all your patterns are gone.
Super annoying.
What was happening?
In LiteLLM’s guardrail settings, the patterns and blocked words were only being sent in the update request if they had changed. So if you only toggled the mode or edited something else, the patterns got wiped out on save.
What I fixed
I updated the logic so that patterns and blocked words are always included when updating a guardrail - whether they changed or not.
Now your custom patterns stay safe no matter what you edit.
PR: https://nehacodes.hashnode.dev/fixing-a-frustrating-bug-in-litellm-guardrails
Lesson Learned
In update operations, never assume existing data will stay unless you explicitly send it. It’s safer to always send the full current state for important fields.
Small fixes like this make developer tools much more reliable and less frustrating to use.
Top comments (0)