quarkusio/quarkus · error · IOException

We didn't found any BackgroundFunction or RawBackgroundFunct

Error message

We didn't found any BackgroundFunction or RawBackgroundFunction to run (or there is multiple one and none selected inside your application.properties)

What it means

After startup, accept() verifies exactly one delegate (BackgroundFunction or RawBackgroundFunction) is set. If none or more than one is set, it throws an IOException meaning the function wiring is inconsistent — either no function was selected or an ambiguous selection left multiple delegates configured.

Source

Thrown at extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/QuarkusBackgroundFunction.java:103

        }
    }

    public static void clearState() {
        delegate = null;
        parameterType = null;
        rawDelegate = null;
        delegateClassLoader = null;
    }

    @Override
    public void accept(String event, Context context) throws Exception {
        if (!started) {
            throw new IOException(deploymentStatus);
        }

        // TODO maybe we can check this at static init
        if ((delegate == null && rawDelegate == null) || (delegate != null && rawDelegate != null)) {
            throw new IOException("We didn't found any BackgroundFunction or RawBackgroundFunction to run " +
                    "(or there is multiple one and none selected inside your application.properties)");
        }

        ClassLoader currentCl = Thread.currentThread().getContextClassLoader();
        try {
            Thread.currentThread().setContextClassLoader(delegateClassLoader);
            if (rawDelegate != null) {
                rawDelegate.accept(event, context);
            } else {
                Gson gson = new Gson();
                try {
                    Object eventObj = gson.fromJson(event, parameterType);
                    delegate.accept(eventObj, context);
                } catch (JsonParseException e) {
                    throw new RuntimeException("Could not parse received event payload into type "
                            + parameterType.getCanonicalName(), e);
                }
            }

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set quarkus.google-cloud-functions.function to select exactly one function.
  2. Ensure your function implements BackgroundFunction or RawBackgroundFunction (or is a CloudEventsFunction for the right handler) and is annotated/discovered.
  3. If both delegate types are set, review your config so only one function type/name is selected.
  4. Call QuarkusBackgroundFunction.clearState() between tests to avoid leaked delegates.

Example fix

// before (application.properties)
# unset with two background functions
// after
quarkus.google-cloud-functions.function=myBackgroundFn
Defensive patterns

Strategy: validation

Validate before calling

// exactly one delegate must be selected
if (QuarkusBackgroundFunction.delegate == null && QuarkusBackgroundFunction.rawDelegate == null
    || (QuarkusBackgroundFunction.delegate != null && QuarkusBackgroundFunction.rawDelegate != null)) {
  throw new IllegalStateException("Configure exactly one function via quarkus.google-cloud-functions.function");
}

Try / catch

try { handler.accept(event, context); }
catch (IOException e) {
  if (e.getMessage().contains("didn't found any")) {
    log.error("Fix quarkus.google-cloud-functions.function selection");
  }
}

Prevention

When it happens

Trigger: No BackgroundFunction/RawBackgroundFunction bean discovered or selected (delegate and rawDelegate both null), or both set simultaneously (ambiguous configuration selecting multiple delegates).

Common situations: Missing quarkus.google-cloud-functions.function selection with multiple background functions; wrong function type deployed (HTTP function configured but background event arrives); stale delegates not cleared between invocations in tests.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/5db04d7815df047f. Report an issue: GitHub.