quarkusio/quarkus · error · RuntimeException

Multiple functions found, please use 'quarkus.google-cloud-f

Error message

Multiple functions found, please use 'quarkus.google-cloud-functions.function' to select one

What it means

When no function name is configured (quarkus.google-cloud-functions.function unset) and more than one function of the same function type is discovered, the recorder cannot pick a delegate and throws this RuntimeException at startup.

Source

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

        Map<GoogleCloudFunctionInfo.FunctionType, String> delegates = new HashMap<>();
        // if a function name is defined, check that it exists
        if (runtimeConfig.getValue().function().isPresent()) {
            String functionName = runtimeConfig.getValue().function().get();
            boolean found = false;
            for (GoogleCloudFunctionInfo info : cloudFunctions) {
                if (functionName.equals(info.getBeanName())) {
                    delegates.put(info.getFunctionType(), info.getClassName());
                    found = true;
                }
            }
            if (!found) {
                throw new RuntimeException(
                        "No function named " + functionName + ", did you forget to annotate your function with @Named ?");
            }
        } else {
            for (GoogleCloudFunctionInfo info : cloudFunctions) {
                if (delegates.containsKey(info.getFunctionType())) {
                    throw new RuntimeException(
                            "Multiple functions found, please use 'quarkus.google-cloud-functions.function' to select one");
                }
                delegates.put(info.getFunctionType(), info.getClassName());
            }
        }
        QuarkusHttpFunction.setDelegate(delegates.get(GoogleCloudFunctionInfo.FunctionType.HTTP));
        QuarkusBackgroundFunction.setDelegates(delegates.get(GoogleCloudFunctionInfo.FunctionType.BACKGROUND),
                delegates.get(GoogleCloudFunctionInfo.FunctionType.RAW_BACKGROUND));
        QuarkusCloudEventsFunction.setDelegate(delegates.get(GoogleCloudFunctionInfo.FunctionType.CLOUD_EVENT));

        shutdownContext.addShutdownTask(new Runnable() {
            @Override
            public void run() {
                QuarkusHttpFunction.clearState();
                QuarkusBackgroundFunction.clearState();
                QuarkusCloudEventsFunction.clearState();
            }
        });

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set quarkus.google-cloud-functions.function to the bean name of the function to deploy (annotate it with @Named).
  2. Split functions into separate deployments if each must be its own GCF function.
  3. Keep only one function per application if you don't want to configure selection.

Example fix

// before (application.properties)
# unset, two functions present
// after
quarkus.google-cloud-functions.function=myFunction
Defensive patterns

Strategy: validation

Validate before calling

// count functions; require selection when >1
count=$(grep -rl 'CloudEventsFunction\|HttpFunction\|BackgroundFunction' src/main/java | wc -l)
if [ "$count" -gt 1 ] && ! grep -q 'quarkus.google-cloud-functions.function' src/main/resources/application.properties; then
  echo 'Multiple functions: set quarkus.google-cloud-functions.function'; exit 1;
fi

Prevention

When it happens

Trigger: Application contains multiple Google Cloud Functions of the same type (e.g. two HTTP functions or two CloudEvent functions) and quarkus.google-cloud-functions.function is not set.

Common situations: Adding a second function to a project that previously had one; deploying multiple handlers for different events without configuring which to use.

Related errors


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