apache/pulsar · error · IllegalArgumentException

Instance Id is not provided

Error message

%s Instance Id is not provided

What it means

An IllegalArgumentException thrown by ComponentImpl.validateGetFunctionInstanceRequestParams when the instanceId is null while fetching a specific function/sink/source instance status or stats. It first delegates to validateGetFunctionRequestParams, then checks the instance identifier.

Solutions

  1. Pass the instance id (integer index of the instance) to the call
  2. If you want aggregate status, call the non-instance variant (getFunctionStatus) instead
  3. Fix config wiring so the instance id is populated

Example fix

// before
admin.functions().getFunctionStatus("public", "default", "my-fn", null);
// after
admin.functions().getFunctionStatus("public", "default", "my-fn", 0);
Defensive patterns

Strategy: validation

Validate before calling

Objects.requireNonNull(instanceId, "instanceId must be provided for instance-level status calls");

Type guard

static boolean hasInstanceId(Integer instanceId) {
    return instanceId != null && instanceId >= 0;
}

Try / catch

try {
    return admin.functions().getFunctionStatus(tenant, ns, name, instanceId);
} catch (IllegalArgumentException e) {
    if (e.getMessage().endsWith("Instance Id is not provided")) {
        // use aggregate API instead
        return admin.functions().getFunctionStatus(tenant, ns, name);
    }
    throw e;
}

Prevention

When it happens

Trigger: Calling getFunctionInstance APIs (e.g. GET .../functions/{tenant}/{namespace}/{function}/{instanceId} via admin API getFunctionStatus with a null instanceId argument).

Common situations: Loop over instances where the instance index variable was never set; request built from config where the instance id field is absent; mixing up getFunctionStatus (all instances) with getFunctionInstanceStatus (per instance) calls.

Understand the failure class

Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/7008b2d2d8f286da. Report an issue: GitHub.

Appendix: source

Thrown at pulsar-functions/worker/src/main/java/org/apache/pulsar/functions/worker/rest/api/ComponentImpl.java:1564

    private void validateListFunctionRequestParams(final String tenant, final String namespace)
            throws IllegalArgumentException {

        if (tenant == null) {
            throw new IllegalArgumentException("Tenant is not provided");
        }
        if (namespace == null) {
            throw new IllegalArgumentException("Namespace is not provided");
        }
    }

    protected void validateGetFunctionInstanceRequestParams(final String tenant,
                                                            final String namespace,
                                                            final String componentName,
                                                            final FunctionDetails.ComponentType componentType,
                                                            final String instanceId) throws IllegalArgumentException {
        validateGetFunctionRequestParams(tenant, namespace, componentName, componentType);
        if (instanceId == null) {
            throw new IllegalArgumentException(String.format("%s Instance Id is not provided", componentType));
        }
    }

    protected void validateGetFunctionRequestParams(String tenant, String namespace, String subject,
                                                    FunctionDetails.ComponentType componentType)
            throws IllegalArgumentException {

        if (tenant == null) {
            throw new IllegalArgumentException("Tenant is not provided");
        }
        if (namespace == null) {
            throw new IllegalArgumentException("Namespace is not provided");
        }
        if (subject == null) {
            throw new IllegalArgumentException(ComponentTypeUtils.toString(componentType) + " name is not provided");
        }
    }

View on GitHub (pinned to 820761864e)