Exceeding 4MB Max Config Size
The maximum size of a CircleCI configuration file (config.yml) is 4MB. When this limit is exceeded, customers may see errors such as "Unexpected exception processing config" or "A compiled config YAML must be at most 4MB" or "Your compiled config is too large to be processed. Please contact support." in their build logs.
It is important to remember that this is the compiled configuration. This is the result of expanding any YAML anchors and aliases as well as importing all required/imported orbs' commands.
As of January 2023, the limit was increased from 3MB to 4MB.
Troubleshooting oversize config files
To find out the size of the final compiled configuration, use the CircleCI CLI to process the original config. From here, you can inspect the compiled configuration file using the commands below:
circleci config process .circleci/config.yml > compiled.yml
ls -lH compiled.yml
Please note that the command below will fail if your compiled YAML file exceeds the 4MB limit.
These commands are meant to help you figure out if your current config is nearing the limit.
We have a collection of useful tips to potentially reduce the size of the compiled config file.
If you choose to move your commands into scripts, you could also utilize workspaces to copy external scripts between jobs, so you don't need to do a full checkout every time.