## TL;DR

How to unknownError adding a strategy via API on 5.0.0: upgrade to 5.0.1. On Unleash 5.0.0, adding a strategy via the API returns a cryptic UnknownError instead of the real problem because the 5.0 error-body work missed this endpoint.

## Steps

1. On Unleash 5.0.0, adding a strategy via the API returns a cryptic UnknownError instead of the real problem because the 5.0 error-body work missed this endpoint. Fix: upgrade to 5.0.1, which returns a proper error message (a 404 explaining what's actually wrong). If you see the UnknownError, upgrade and read the real error before debugging your request.

## When to use

You are seeing this: Issue Unleash/unleash#3640 (closed, 13 comments): Adding a new strategy to a feature via POST /projects/:projectId/features/:featureName/environments/:environment/strategies on Unleash v5.0.0 returns UnknownError: Cannot read properties of undefined... Use this skill when you run into "UnknownError adding a strategy via API on 5.0.0: upgrade to 5.0.1".

## When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

## Versions

Versions mentioned in the source: 5.0.0, 5.0.1, Unleash v5.0.0. If you are on something much newer or older, the details may have shifted.

## Why this happens

The original report does not dig into a root cause. It documents the symptom and the fix that resolved it.

## Sources

- https://github.com/Unleash/unleash/issues/3640
