The error you are encountering when running DBCC CHECKDB on a secondary replica in an Always On Availability Group is due to the fact that secondary databases cannot be exclusively locked for the DBCC CHECKDB operation. When a database is set as a secondary replica, it is primarily meant for read-only access, and certain operations, such as creating a snapshot for consistency checks, are restricted.
In this case, the DBCC CHECKDB command fails because it requires an exclusive lock to perform its checks, which is not possible on a secondary replica where the database is still receiving updates from the primary replica. Therefore, the snapshot creation fails, leading to the error message you see.
To work around this limitation, you might consider running DBCC CHECKDB on the primary replica instead, or using the WITH TABLOCK option, which can help avoid the need for a snapshot by locking the entire table during the check, but this may not be applicable on a secondary replica due to its read-only nature.
For more information on this topic, you can refer to the limitations and restrictions associated with readable secondary replicas in Always On availability groups.