It looks like the docs need a change similar to this PR from the source code repo.
Under the "secrets" section of the admin/config page, the docs for SECRET_KEY_BASE say:
Generate with rake secret. Changing it will break all active browser sessions.
According to mastodon/mastodon#30917, the command should probably be bundle exec rails secret.
@ciencia also called this out in a separate issue two years ago and I encountered the same problem today. Using bundle exec rails secret worked me.