apache/pulsar · error · IllegalArgumentException

Window Configs cannot be found

Error message

Window Configs cannot be found

What it means

The WindowFunctionExecutor requires window configuration (WindowConfig) to be supplied under the user config key WINDOW_CONFIG_KEY. getWindowConfigs throws this IllegalArgumentException when the function's user config map does not contain that key. Without window parameters (window length, sliding interval, etc.) the executor cannot construct a WindowManager, so initialization fails immediately.

Source

Thrown at pulsar-functions/instance/src/main/java/org/apache/pulsar/functions/windowing/WindowFunctionExecutor.java:93

        if (userClassObject instanceof java.util.function.Function) {
            Class<?>[] typeArgs = TypeResolver.resolveRawArguments(
                    java.util.function.Function.class, userClassObject.getClass());
            if (typeArgs[0].equals(Collection.class)) {
                bareWindowFunction = (java.util.function.Function<Collection<T>, X>) userClassObject;
            } else {
                throw new IllegalArgumentException("Window function must take a collection as input");
            }
        } else if (userClassObject instanceof WindowFunction) {
            windowFunction = (WindowFunction<T, X>) userClassObject;
        } else {
            throw new IllegalArgumentException("Window function does not implement the correct interface");
        }
    }

    private WindowConfig getWindowConfigs(Context context) {

        if (!context.getUserConfigValue(WindowConfig.WINDOW_CONFIG_KEY).isPresent()) {
            throw new IllegalArgumentException("Window Configs cannot be found");
        }
        WindowConfig windowConfig = new Gson().fromJson(
                (new Gson().toJson(context.getUserConfigValue(WindowConfig.WINDOW_CONFIG_KEY).get())),
                WindowConfig.class);

        return windowConfig;
    }

    private WindowManager<Record<T>> getWindowManager(WindowConfig windowConfig, Context context) {

        WindowLifecycleListener<Event<Record<T>>> lifecycleListener = newWindowLifecycleListener(context);
        WindowManager<Record<T>> manager = new WindowManager<>(lifecycleListener, new ConcurrentLinkedQueue<>());

        if (this.windowConfig.getTimestampExtractorClassName() != null) {
            this.timestampExtractor = getTimeStampExtractor(windowConfig);

            waterMarkEventGenerator = new WaterMarkEventGenerator<>(manager, this.windowConfig
                    .getWatermarkEmitIntervalMs(),

View on GitHub (pinned to 820761864e)

Solutions

  1. Add the window config to the function's user config, e.g. userConfig: { "windowConfig": { "windowLengthDurationMs": 60000, "slidingIntervalDurationMs": 30000 } }
  2. Verify with `pulsar-admin functions get` that userConfig contains the windowConfig key
  3. If the function should not be windowed, redeploy it as a regular function instead of a windowed one
  4. Recreate the function with the full config if a CLI update silently dropped userConfig

Example fix

// before
pulsar-admin functions create --name wf --inputs in --functionConfig '{"inputTopics":["in"]}'
// after
pulsar-admin functions create --name wf --inputs in \
  --customSerDeInputs ... \
  --userConfig '{"windowConfig":{"windowLengthDurationMs":60000,"slidingIntervalDurationMs":30000}}'
Defensive patterns

Strategy: validation

Validate before calling

Map<String, Object> uc = config.getUserConfig();
if (uc == null || !uc.containsKey("windowConfig")) {
    throw new IllegalArgumentException("userConfig must contain windowConfig with windowLengthDurationMs etc.");
}

Try / catch

try {
    executor.initialize();
} catch (IllegalArgumentException e) {
    throw new IllegalStateException("missing window config in userConfig: " + e.getMessage(), e);
}

Prevention

When it happens

Trigger: Deploying a windowed function whose userConfig omits the WINDOW_CONFIG_KEY entry (JSON key "windowConfig" / WindowConfig.WINDOW_CONFIG_KEY), or supplying an empty/incorrectly named user config map.

Common situations: Deploying a normal (non-windowed) function definition against the windowing executor; typos in the config key; CLI/REST deployment that drops userConfig; serializing window config under the wrong field.

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/f47c015c79d716fb. Report an issue: GitHub.