Builds fail from environment variable size error after a certain number of provisioning profiles is hit

We have three apps, each has several app extensions so we need provisioning profiles for all of them x2 for enterprise and distribution. I recently added a new profile and got the following warnings constantly in the build following the profile step failing:

WARN[16:54:50] environment value (…) too large
WARN[16:54:50] environment value size (20.13671875 KB) - max allowed size: 20 KB

This is the error:

Downloading & installing Provisioning Profile(s)

=> Downloading provisioning profile: 1/2
Downloading (***) to (/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/bitrise-cert-tmp416150944/profile-0.mobileprovision)
Get environment%!v(MISSING)alue%!t(MISSING)oo%!l(MISSING)arge%!-(MISSING)%!r(MISSING)ejected: unsupported protocol scheme “”

I first tried renaming it to be shorter, which bumped the size down closer to 20MB, I then found an old unused profile in our list and removed it which did cause all of our builds to run successful again. My concern is that in the future when we go to add another profile we are going to run into this issue again.

1 Like


Indeed, there’s an undocumented limit here. The limit is around 50 prov profiles uploaded to for a single app (under Code Signing & Files).

The solution / workaround for this right now is to use the Generic File Storage option (under Code Signing & Files). There every uploaded file gets it’s own download URL environment variable, which use can use the way you want to. E.g. you can use multiple separate Certificate and Profile installer steps, and concat the URLs with the pipe (|) character, as described in the inputs’ description.

Another solution can be to use a single ZIP file, which can be uploaded as a single Generic File Storage item, then use e.g. the ZIP resource archive downloader step to download & uncompress those, then specify the local paths for the Certificate and Profile installer step (again, can be concatenated with |, and you can use as many Cert & Profile installer step as you like). Or, alternatively, just move the prov profile files into $HOME/Library/MobileDevice/Provisioning Profiles any way you like (e.g. uncompress the ZIP there). Xcode uses that dir too, there’s no special “install” command for profiles, you just have to move the Prov Profile files into this directory. Note: the files have to be in that directory specifically, sub directories are NOT scanned by Xcode.

I hope this helps, if you have any questions just let us know!

Another possible solution: store the Provisioning Profiles in your repository, and just copy those with a Script step into the $HOME/Library/MobileDevice/Provisioning Profiles directory.

Example script:

set -ex

rsync -avhP ./path/to/profiles/dir/in/repo/ "$HOME/Library/MobileDevice/Provisioning Profiles/"

Note: please don’t store the Certificate (.p12) in the repository, that’s a security issue! Upload those to or download from another source. But in general Prov Profiles are safe to be stored in the repository. You can of course store it in a separate repository too, the script works with any source, installing profiles is as simple as moving the files into the $HOME/Library/MobileDevice/Provisioning Profiles/ directory.