the problem
With v3 of the CAPI API, it seems like it's impossible to create a package with more than 5000 matched resources.
If you try it, you may run into this issue:
[ERROR]: Errors occured during script execution. Errors are:
- Application push operation failed. Root cause of the failure should be mentioned below
- CF-UnprocessableEntity(10008): Resources array can have at most 5000 resources
org.cloudfoundry.client.v3.ClientV3Exception: CF-UnprocessableEntity(10008): Resources array can have at most 5000 resources
the suggested solution
The fix would be to chunk such large requests into chunks of request with 5000 max resources.