`feature variant update` fails with a 500: the API needs `feature` and `default_percentage_allocation` in the PATCH

Offen
#125 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 2 Tagen

@Anuragkumar-687 arbeitet bereits daran.

Seit 28.11.2026.

  • #127 von @Anuragkumar-687 — offen

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
Ein halber Tag
Anfängerfreundlichkeit
45/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Veraltet
Tech-Stack
go
Bereich
cli

Rechercherichtung

Start with internal/api/client.go and trace the feature variant update command to the UpdateMVOption request. The API requires feature, default_percentage_allocation, and the value fields in the PATCH body; read the option first and include those fields when sending the update. Reproduce with the documented flagsmith feature variant update command and verify that the request no longer returns a 500.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

flagsmith feature variant update sends a PATCH with only the changed fields (UpdateMVOption in internal/api/client.go). Flagsmith's API doesn't support partial updates of multivariate options: MultivariateFeatureOptionSerializer.validate() reads attrs["feature"]. That was reported in Flagsmith/flagsmith#8073, which was closed with "I don't think we properly support partial PATCH requests anywhere in our API". So the command fails with a 500 every time.

Tested with CLI v2.0.0 against self-hosted Flagsmith 2.295.2.

Steps to reproduce

flagsmith feature create button-colour --value blue --enabled
flagsmith feature variant add button-colour --value red --weight 50 --yes
flagsmith feature variant update button-colour <variant-id> --key red --yes
# Error: PATCH …/features/<id>/mv-options/<variant-id>/ returned 500 Internal Server Error

What the API accepts (checked against 2.295.2):

PATCH body Result
{"key": "red"} 500
{"feature": 46, "key": "red"} 500
{"feature": 46, "key": "red", "default_percentage_allocation": 50} 200

Suggested fix: read the option first, then send feature and default_percentage_allocation (and the value fields) along with the change.

Found while building flagsmith-toolbar, whose demo is set up with the CLI.

Vorherrschende Sprache
Go
Sterne
14
Forks
4
Ø Merge
3 T. 7 Std.
Gemergte PRs (30 T.)
4

Entwicklungsumgebung

  • Enthält ein Dockerfile oder eine Docker-Compose-Datei
  • Keine Pull-Request-Vorlage
  • Kein Beitragsleitfaden

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus Flagsmith/flagsmith-cli

Alle Issues in Flagsmith/flagsmith-cli

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.