Upgrade 21.8.0 migration erro

When I upgrade to 21.8.0 I get the following error:

Migration sentry.0201_semver_package is applied before its dependency sentry.0001_squashed_0200_release_indices on database ‘default’.

How to fix this?

You need to upgrade to 21.6.3 first: https://develop.sentry.dev/self-hosted/releases/#hard-stops