{"record":{"id":"3fbc29baf9dd62c5","repo":"quarkusio/quarkus","slug":"multiple-functions-found-please-use-quarkus-goog","errorCode":null,"errorMessage":"Multiple functions found, please use 'quarkus.google-cloud-functions.function' to select one","messagePattern":"Multiple functions found, please use 'quarkus\\.google-cloud-functions\\.function' to select one","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/GoogleCloudFunctionRecorder.java","lineNumber":39,"sourceCode":"        Map<GoogleCloudFunctionInfo.FunctionType, String> delegates = new HashMap<>();\n        // if a function name is defined, check that it exists\n        if (runtimeConfig.getValue().function().isPresent()) {\n            String functionName = runtimeConfig.getValue().function().get();\n            boolean found = false;\n            for (GoogleCloudFunctionInfo info : cloudFunctions) {\n                if (functionName.equals(info.getBeanName())) {\n                    delegates.put(info.getFunctionType(), info.getClassName());\n                    found = true;\n                }\n            }\n            if (!found) {\n                throw new RuntimeException(\n                        \"No function named \" + functionName + \", did you forget to annotate your function with @Named ?\");\n            }\n        } else {\n            for (GoogleCloudFunctionInfo info : cloudFunctions) {\n                if (delegates.containsKey(info.getFunctionType())) {\n                    throw new RuntimeException(\n                            \"Multiple functions found, please use 'quarkus.google-cloud-functions.function' to select one\");\n                }\n                delegates.put(info.getFunctionType(), info.getClassName());\n            }\n        }\n        QuarkusHttpFunction.setDelegate(delegates.get(GoogleCloudFunctionInfo.FunctionType.HTTP));\n        QuarkusBackgroundFunction.setDelegates(delegates.get(GoogleCloudFunctionInfo.FunctionType.BACKGROUND),\n                delegates.get(GoogleCloudFunctionInfo.FunctionType.RAW_BACKGROUND));\n        QuarkusCloudEventsFunction.setDelegate(delegates.get(GoogleCloudFunctionInfo.FunctionType.CLOUD_EVENT));\n\n        shutdownContext.addShutdownTask(new Runnable() {\n            @Override\n            public void run() {\n                QuarkusHttpFunction.clearState();\n                QuarkusBackgroundFunction.clearState();\n                QuarkusCloudEventsFunction.clearState();\n            }\n        });","sourceCodeStart":21,"sourceCodeEnd":57,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/GoogleCloudFunctionRecorder.java#L21-L57","documentation":"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.","triggerScenarios":"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.","commonSituations":"Adding a second function to a project that previously had one; deploying multiple handlers for different events without configuring which to use.","solutions":["Set quarkus.google-cloud-functions.function to the bean name of the function to deploy (annotate it with @Named).","Split functions into separate deployments if each must be its own GCF function.","Keep only one function per application if you don't want to configure selection."],"exampleFix":"// before (application.properties)\n# unset, two functions present\n// after\nquarkus.google-cloud-functions.function=myFunction","handlingStrategy":"validation","validationCode":"// count functions; require selection when >1\ncount=$(grep -rl 'CloudEventsFunction\\|HttpFunction\\|BackgroundFunction' src/main/java | wc -l)\nif [ \"$count\" -gt 1 ] && ! grep -q 'quarkus.google-cloud-functions.function' src/main/resources/application.properties; then\n  echo 'Multiple functions: set quarkus.google-cloud-functions.function'; exit 1;\nfi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Annotate each function with @Named and set the config when you have several","Deploy one function per application to avoid ambiguity","Add a startup smoke test with production properties","Document function names in the project README"],"tags":["google-cloud-functions","configuration","ambiguous"],"backgroundTag":"ambiguous-function-selection","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}