You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Partially updating a multivariate option returns 500 #8901
Self Hosted with Docker (docker.flagsmith.com/flagsmith/flagsmith:latest = 2.290.0, upstream docker-compose.yml)
Self Hosted with Kubernetes
SaaS at flagsmith.com
Some other way
Describe the bug
PATCH /api/v1/projects/{project_pk}/features/{feature_pk}/mv-options/{id}/ returns 500 Internal Server Error for any partial update of a multivariate option, including the common case of setting a variant key on an existing option.
MultivariateFeatureOptionSerializer.validate() reads attrs["feature"] and attrs["default_percentage_allocation"] unconditionally. DRF omits fields that are not in the request body on partial updates, so the lookup raises KeyError. PUT with a full body works, which is why the dashboard never hits this; API, MCP (update_feature_multivariate_option) and script users do.
Traceback (API container logs):
Internal Server Error: /api/v1/projects/1/features/1/mv-options/1/
...
File ".../rest_framework/serializers.py", line 225, in is_valid
self._validated_data = self.run_validation(self.initial_data)
...
File "/build/api/features/multivariate/serializers.py", line 85, in validate
feature = attrs["feature"]
KeyError: 'feature'
Steps To Reproduce
Run Flagsmith 2.290.0 (upstream docker-compose.yml), create a project and a multivariate feature with one option.
Observe HTTP 500 and the KeyError: 'feature' traceback above. Including "feature": 1 in the body still fails, this time on default_percentage_allocation.
Expected behavior
The option is updated and 200 is returned, with the same allocation and key-uniqueness validation that PUT applies.
Activity