apache/pulsar · error · IllegalArgumentException

Function config is not provided

Error message

Function config is not provided

What it means

FunctionConfigUtils.convert(FunctionConfig, ValidatableFunctionPackage) validates and transforms a user-supplied FunctionConfig into protobuf FunctionDetails. A null FunctionConfig cannot be converted, so it immediately throws this IllegalArgumentException.

Source

Thrown at pulsar-functions/utils/src/main/java/org/apache/pulsar/functions/utils/FunctionConfigUtils.java:92

        private String functionClassName;
        private String typeArg0;
        private String typeArg1;
    }

    static final Integer MAX_PENDING_ASYNC_REQUESTS_DEFAULT = 1000;
    static final Boolean FORWARD_SOURCE_MESSAGE_PROPERTY_DEFAULT = Boolean.TRUE;

    private static final ObjectMapper OBJECT_MAPPER = ObjectMapperFactory.create();

    public static FunctionDetails convert(FunctionConfig functionConfig) {
        return convert(functionConfig, (ValidatableFunctionPackage) null);
    }

    public static FunctionDetails convert(FunctionConfig functionConfig,
                                          ValidatableFunctionPackage validatableFunctionPackage)
            throws IllegalArgumentException {
        if (functionConfig == null) {
            throw new IllegalArgumentException("Function config is not provided");
        }
        if (functionConfig.getRuntime() == FunctionConfig.Runtime.JAVA && validatableFunctionPackage != null) {
            return convert(functionConfig, doJavaChecks(functionConfig, validatableFunctionPackage));
        } else {
            return convert(functionConfig, new ExtractedFunctionDetails(functionConfig.getClassName(), null, null));
        }
    }

    @SuppressWarnings("deprecation")
    public static FunctionDetails convert(FunctionConfig functionConfig, ExtractedFunctionDetails extractedDetails)
             throws IllegalArgumentException {

        boolean isBuiltin = !StringUtils.isEmpty(functionConfig.getJar())
                && functionConfig.getJar().startsWith(org.apache.pulsar.common.functions.Utils.BUILTIN);

        FunctionDetails functionDetails = new FunctionDetails();

        // Setup source

View on GitHub (pinned to 820761864e)

Solutions

  1. Construct and populate the FunctionConfig before calling convert (set tenant, namespace, name, className, inputs, runtime, etc.)
  2. Check that your REST/CLI layer actually parses the submitted function configuration into a non-null FunctionConfig
  3. Add a null check in your calling code and surface a clear client-facing validation error
  4. If using the Java client, verify the config serialization/deserialization isn't dropping the functionConfig field

Example fix

// before
FunctionConfig cfg = null;
FunctionDetails d = FunctionConfigUtils.convert(cfg, pkg); // throws
// after
FunctionConfig cfg = new FunctionConfig();
cfg.setTenant("public"); cfg.setNamespace("default"); cfg.setName("f"); cfg.setClassName("com.ex.MyFn");
FunctionDetails d = FunctionConfigUtils.convert(cfg, pkg);
Defensive patterns

Strategy: validation

Validate before calling

// Null-check before convert
if (functionConfig == null) {
  throw new IllegalArgumentException("functionConfig must be provided");
}
// optionally also verify required fields
if (functionConfig.getClassName() == null || functionConfig.getTenant() == null) {
  throw new IllegalArgumentException("functionConfig incomplete");
}

Type guard

static boolean hasConfig(FunctionConfig cfg) { return cfg != null; }

Try / catch

try {
  FunctionDetails d = FunctionConfigUtils.convert(cfg, pkg);
} catch (IllegalArgumentException e) {
  if ("Function config is not provided".equals(e.getMessage())) {
    log.error("No FunctionConfig supplied - check request binding");
    throw new BadRequestException("functionConfig is required");
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling convert(null, validatableFunctionPackage) or otherwise passing a null FunctionConfig reference — typically from a CLI/REST handler where the config object was never constructed, or a deserialization path that produced a null config.

Common situations: Programmatic function submission where FunctionConfig was left uninitialized; REST payloads that fail to bind into a FunctionConfig object; scripts that call the internal conversion API directly; refactored code paths that dropped config initialization.

Understand the failure class

Background: "X is required", "must be set", "cannot be empty": the missing-required-config error family, from Vertex AI project/location to WeChat keys — this error's family across 18 libraries.

Related errors


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