{"record":{"id":"5db04d7815df047f","repo":"quarkusio/quarkus","slug":"we-didn-t-found-any-backgroundfunction-or-rawbackg","errorCode":null,"errorMessage":"We didn't found any BackgroundFunction or RawBackgroundFunction to run (or there is multiple one and none selected inside your application.properties)","messagePattern":"We didn't found any BackgroundFunction or RawBackgroundFunction to run \\(or there is multiple one and none selected inside your application\\.properties\\)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/QuarkusBackgroundFunction.java","lineNumber":103,"sourceCode":"        }\n    }\n\n    public static void clearState() {\n        delegate = null;\n        parameterType = null;\n        rawDelegate = null;\n        delegateClassLoader = null;\n    }\n\n    @Override\n    public void accept(String event, Context context) throws Exception {\n        if (!started) {\n            throw new IOException(deploymentStatus);\n        }\n\n        // TODO maybe we can check this at static init\n        if ((delegate == null && rawDelegate == null) || (delegate != null && rawDelegate != null)) {\n            throw new IOException(\"We didn't found any BackgroundFunction or RawBackgroundFunction to run \" +\n                    \"(or there is multiple one and none selected inside your application.properties)\");\n        }\n\n        ClassLoader currentCl = Thread.currentThread().getContextClassLoader();\n        try {\n            Thread.currentThread().setContextClassLoader(delegateClassLoader);\n            if (rawDelegate != null) {\n                rawDelegate.accept(event, context);\n            } else {\n                Gson gson = new Gson();\n                try {\n                    Object eventObj = gson.fromJson(event, parameterType);\n                    delegate.accept(eventObj, context);\n                } catch (JsonParseException e) {\n                    throw new RuntimeException(\"Could not parse received event payload into type \"\n                            + parameterType.getCanonicalName(), e);\n                }\n            }","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/google-cloud-functions/runtime/src/main/java/io/quarkus/gcp/functions/QuarkusBackgroundFunction.java#L85-L121","documentation":"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.","triggerScenarios":"No BackgroundFunction/RawBackgroundFunction bean discovered or selected (delegate and rawDelegate both null), or both set simultaneously (ambiguous configuration selecting multiple delegates).","commonSituations":"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.","solutions":["Set quarkus.google-cloud-functions.function to select exactly one function.","Ensure your function implements BackgroundFunction or RawBackgroundFunction (or is a CloudEventsFunction for the right handler) and is annotated/discovered.","If both delegate types are set, review your config so only one function type/name is selected.","Call QuarkusBackgroundFunction.clearState() between tests to avoid leaked delegates."],"exampleFix":"// before (application.properties)\n# unset with two background functions\n// after\nquarkus.google-cloud-functions.function=myBackgroundFn","handlingStrategy":"validation","validationCode":"// exactly one delegate must be selected\nif (QuarkusBackgroundFunction.delegate == null && QuarkusBackgroundFunction.rawDelegate == null\n    || (QuarkusBackgroundFunction.delegate != null && QuarkusBackgroundFunction.rawDelegate != null)) {\n  throw new IllegalStateException(\"Configure exactly one function via quarkus.google-cloud-functions.function\");\n}","typeGuard":null,"tryCatchPattern":"try { handler.accept(event, context); }\ncatch (IOException e) {\n  if (e.getMessage().contains(\"didn't found any\")) {\n    log.error(\"Fix quarkus.google-cloud-functions.function selection\");\n  }\n}","preventionTips":["Set quarkus.google-cloud-functions.function when multiple functions exist","Ensure the deployed function type matches the event type (background vs HTTP)","Call QuarkusBackgroundFunction.clearState() between unit tests","Verify with a local integration test that one delegate is wired"],"tags":["google-cloud-functions","configuration","wiring"],"backgroundTag":"no-function-delegate-found","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}