2 answers
Hello@Alejandro Báscones,
- check all permission set https://salesforce.stackexchange.com/questions/396856/soql-find-all-permission-sets-with-a-given-custom-permission
- If not working, then try in new fresh org, it might be the existing record causing the issues in your org.