I received the error message "Sorry, the profile you have chosen cannot be loaded." after selecting a profile to install.
This doesn't give much explanation about what the issue is, or how to fix it, and is one of many reasons why people find Drupal so frustrating.
I will attach a patch below that provides two error messages:
The profile is not in the correct directory; it was expected to be in: @profile-dir. Please fix this and try again.
or
The profile file @profile-file is missing. Please fix this and try again.
An even better fix would be per @webchick's request here: https://www.drupal.org/node/1681668.
That said, I can't find where Drupal 8 has a similar piece of code, so I believe this fix can be applied to Drupal 7 without waiting on a Drupal 8 patch.
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | 2481095-4.patch | 635 bytes | David_Rothstein |
| #2 | Sorry_the_profile_you_have_chosen_cannot_be_loaded-2481095-3.patch | 1.47 KB | darrellduane |
Comments
Comment #1
darrellduane commentedComment #2
darrellduane commentedHere is the file.
Comment #3
bernman commentedThis patch worked great for helping me find a typo in my drush makefile. Wouldn't have spotted the error otherwise.
Comment #4
David_Rothstein commentedI agree this error message can be improved. However we are not supposed to use "Please" in the text (see https://www.drupal.org/docs/develop/user-interface-standards/interface-text).
Also, why go through the trouble of changing it to have two separate messages - why not just give people the full path to the file in either case? See attached patch.
Comment #5
David_Rothstein commentedIt would also be worth figuring out why the profile is showing up as an option to select in the first place... seems like if it's broken and in the wrong place in the file system, it should not appear as something you can select.
But I guess that's a different issue.
Comment #6
David_Rothstein commentedReason seems to be that https://api.drupal.org/api/drupal/includes!install.core.inc/function/ins... calls https://api.drupal.org/api/drupal/includes!install.core.inc/function/ins... which just scans the profiles directory for every .profile file (regardless of whether it's in the expected subdirectory). So to fix the root cause of this we could fix that too.