Restic always errors with `Fatal: maximum number of keys reached`

I have a restic repo which stores log files of a system.
It is backed up hourly by cronjob and tagged with the date.
Since one day I get the error with every restic operation.

Fatal: maximum number of keys reached

Attempted commands:

restic unlock
restic restic forget --keep-hourly 24 --keep-daily 31 --keep-weekly 4 --keep-monthly 12 --keep-yearly 100 --prune
restic rebuild-index
restic stats
restic snapshot

Used restic version:

restic version
restic 0.14.0 compiled with go1.19 on linux/amd64

I looked into the restic repo and found:

// ErrMaxKeysReached is returned when the maximum number of keys was checked and no key could be found.
	ErrMaxKeysReached = errors.Fatal("maximum number of keys reached")

What is the diffence to the wrong password error?

It looks like you have more than 20 keys in your repository. restic gave up after trying the first 20 ones (which probably already took at least 10 seconds). At that number of keys the recommended way is to tell restic which one to use by specifying a --key-hint <key-id> to use.

Hi MichaekEischer

thank you for the hint.
This resolved my problem.