vRA / vRO 7.6 - retrieve >100 vms using workflow fails, even with raising limits + pagination

I have stumbled upon a know error, but do not know how to fix it.

I use an odata query since the time when the limit was set in the vRA plugin, following the resolution in VMware Knowledge Base

ATM I want to query about 500 VMs. Follwoing error is displayed:

state: 'failed', business state: 'null', exception: '[Rest Composite Exception]:  ( [Rest Error]: {Status code: 400}, {Error code: 20152} , {Error Source: null}, {Error Msg: Error while retrieving resources from provider [Infrastructure Service] for resource type [Virtual Machine].}, {System Msg: Error while retrieving resources from provider [{}] for resource type [{}].} )  ( [Rest Error]: {Status code: 400}, {Error code: 42000} , {Error Source: null}, {Error Msg: Request was denied due to exceeded resource size limit. The maximum number of resources allowed is 100.}, {System Msg: Infrastructure service provider error: Request was denied due to exceeded resource size limit. The maximum number of resources allowed is 100.}

Here is the code I use:

// Query each business group on each host for catalog reosurces; this will include cafe vms AND deployments

    for each (host in cafeHosts){

        service = host.createCatalogClient().getCatalogConsumerResourceService();

        for each (businessGroup in businessGroups){

            var filter = new Array();

            filter[0] = vCACCAFEFilterParam.substringOf("organization/subTenant/id", vCACCAFEFilterParam.string(;

            var query = vCACCAFEOdataQuery.query().addFilter(filter);

            var odataRequest = new vCACCAFEPageOdataRequest(1, 700, query);

            resources = service.getResourcesList(odataRequest);

            vCACCAFEVMs = vCACCAFEVMs.concat(resources);



    System.log("[LOG] Total Found CatalogResource items: " + vCACCAFEVMs.length);

Inputs are an array of cafe hosts and subtenants (businessGroups).

The above mentioned error is displayed even though the query limit is raised up to 1000.

When using pagination, like here:

var odataRequest = new vCACCAFEPageOdataRequest(2, 500, query);

zero results are returned.

Alternatively, starting a query using the finder method:

vCACCAFEVMs = Server.findAllForType("vCACCAFE:CatalogResource");

results in the script freezing and the vRO server using more and more heap memory (up until it probably crashes, with an OOM error):


Plugin versions used:

VRAServer 7.6.0-SNAPSHOT.12974158



What is the currently correct method for querying >100 vRA VMs?

Edit: After a vco-server restart and changing the code to

for each (host in cafeHosts){

    var service = host.createCatalogClient().getCatalogConsumerResourceService();

    var query = vCACCAFEOdataQuery.query();

    var i;

    for (i = 1; i < 21; i++){

        var items = service.getResourcesList(new vCACCAFEPageOdataRequest(i, 100, query));

        if (items.length == 0) { break }

        vCACCAFEVMs = vCACCAFEVMs.concat(items);



I get correct results again.

I still have no idea why the "limits exceeded" error appears even when the query limit is lifted.

0 Kudos
0 Replies