The Security-usage API (/policy/api/v1/licenses/security-usage) fails with BAD_REQUEST
search cancel

The Security-usage API (/policy/api/v1/licenses/security-usage) fails with BAD_REQUEST

book

Article ID: 428800

calendar_today

Updated On:

Products

VMware vDefend Firewall

Issue/Introduction

Symptoms:
- Security-usage API returns BAD_REQUEST error

GET https:///api/v1/licenses/security-usage fails with following error:

"httpStatus": "BAD_REQUEST",
    "error_code": 612890,
    "module_name": "policy",
    "error_message": "Security licensed core usage collection task is not completed. Please wait for task to be completed as per schedule: 0 0 0 * * ?."
}

- Stale HostDiscoveredNodeRelationshipMsg records exist in the database referencing non-existent HostModel or DiscoveredNode objects
- Core usage collection fails during license usage calculation

Environment

NSX-T 4.2.1

Cause

One of the possible cause is the HostDiscoveredNodeRelationshipMsg cleanup logic in StreamService was conditional - it skipped relationship cleanup when the corresponding HostModel lookup failed during HostTransportNode deletion. This left orphaned relationship records in the database that referenced non-existent objects, causing the security-usage API to fail when it attempted to process these stale records.

Resolution

The issue is fixed in 9.2

Workaround:

1.Restart the cm-inventory service to trigger the startup cleanup, which will automatically detect and remove stale HostDiscoveredNodeRelationshipMsg records. 

NSX root mode:
/etc/init.d/cm-inventory status
/etc/init.d/cm-inventory restart

NSX Manager Admin Mode:
get service cm-inventory
restart service cm-inventory

2.After cleanup completes, wait for 24 hours and then the security-usage API will return valid responses.

Additional Information

GET API through following error:

GET https://<NSX-Manager>/api/v1/licenses/security-usage

Output:
"httpStatus": "BAD_REQUEST",
    "error_code": 612890,
    "module_name": "policy",
    "error_message": "Security licensed core usage collection task is not completed. Please wait for task to be completed as per schedule: 0 0 0 * * ?."
}

nsx syslog

2026-01-05T16:00:00.007Z <nsx-manager> NSX xxxx SYSTEM [nsx@xxxx audit="true" comp="nsx-manager" level="INFO" subcomp="manager"] UserName:'admin' ModuleName:'policy' Operation:'GET@/api/v1/licenses/security-usage' Operation status: 'failure' Error: Security licensed core usage collection task is not completed. Please wait for task to be completed as per schedule: 0 0 0 * * ?.

2026-01-05T17:00:00.007Z  INFO SECURITY_LICENSE_USAGE_METER-0 ComputeCollectionFinderImpl 3061336 FABRIC [nsx@xxxx comp="nsx-manager" level="INFO" subcomp="manager"] Number of hosts 1 found from Compute collection id <compute_id>:<domain_id>
2026-01-05T17:00:00.007Z ERROR SECURITY_LICENSE_USAGE_METER-0 TaskUtils$LoggingErrorHandler 3061336 Unexpected error occurred in scheduled task
java.lang.NullPointerException: null
        at com.vmware.nsx.management.policy.security.license.SecurityLicenseUsageMeterTask.populateTransportNodes(SecurityLicenseUsageMeterTask.java:670) ~[?:?]
        at com.vmware.nsx.management.policy.security.license.SecurityLicenseUsageMeterTask.collectHostFeatureDetailsHashMap(SecurityLicenseUsageMeterTask.java:648) ~[?:?]
        at com.vmware.nsx.management.policy.security.license.SecurityLicenseUsageMeterTask.run(SecurityLicenseUsageMeterTask.java:171)