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.

Comments

darrellduane’s picture

Status: Active » Needs review
StatusFileSize
new1.47 KB

Here is the file.

bernman’s picture

Status: Needs review » Reviewed & tested by the community

This patch worked great for helping me find a typo in my drush makefile. Wouldn't have spotted the error otherwise.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new635 bytes

I 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.

David_Rothstein’s picture

It 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.

David_Rothstein’s picture

It would also be worth figuring out why the profile is showing up as an option to select in the first place

Reason 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.

Status: Needs review » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.