{"record":{"id":"d47ed91505eaf56d","repo":"quarkusio/quarkus","slug":"only-one-of-runtimevalue-function-or-assistantfun","errorCode":null,"errorMessage":"Only one of runtimeValue, function or assistantFunction is allowed","messagePattern":"Only one of runtimeValue, function or assistantFunction is allowed","errorType":"validation","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/buildtime/BuildTimeActionBuildItem.java","lineNumber":169,"sourceCode":"            return this;\n        }\n\n        public ActionBuilder enableMcpFunctionByDefault() {\n            this.mcpEnabledByDefault = true;\n            return this;\n        }\n\n        /**\n         * @deprecated Use {@link #enableMcpFunctionByDefault()} instead.\n         */\n        @Deprecated(forRemoval = true)\n        public ActionBuilder enableMcpFuctionByDefault() {\n            return enableMcpFunctionByDefault();\n        }\n\n        public <T> ActionBuilder function(Function<Map<String, String>, T> function) {\n            if (this.runtimeValue != null || this.assistantFunction != null)\n                throw new IllegalStateException(\"Only one of runtimeValue, function or assistantFunction is allowed\");\n            this.function = function;\n            return this;\n        }\n\n        public <T> ActionBuilder assistantFunction(BiFunction<Object, Map<String, String>, ?> assistantFunction) {\n            if (this.function != null || this.runtimeValue != null)\n                throw new IllegalStateException(\"Only one of runtimeValue, function or assistantFunction is allowed\");\n            this.assistantFunction = assistantFunction;\n            return this;\n        }\n\n        public ActionBuilder runtime(RuntimeValue<?> runtimeValue) {\n            if (this.function != null || this.assistantFunction != null)\n                throw new IllegalStateException(\"Only one of runtimeValue, function or assistantFunction is allowed\");\n            this.runtimeValue = runtimeValue;\n            return this;\n        }\n","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/devui/deployment-spi/src/main/java/io/quarkus/devui/spi/buildtime/BuildTimeActionBuildItem.java#L151-L187","documentation":"BuildTimeActionBuildItem.ActionBuilder.function() throws this when a runtimeValue or assistantFunction was already set. An action can only have exactly one backing implementation, so setters are mutually exclusive.","triggerScenarios":"Chaining e.g. builder.runtime(rv).function(f) or calling function() twice on the same ActionBuilder.","commonSituations":"Refactoring from a runtime-value-backed action to a function-backed one without removing the runtime() call.","solutions":["Remove the earlier runtime(...) or assistantFunction(...) call so only function(...) remains","If you want both behaviors, combine them in a single Function instead of setting two"],"exampleFix":"// before\nbuilder.runtime(myRuntimeValue).function(this::myFunction);\n// after\nbuilder.function(this::myFunction);","handlingStrategy":"validation","validationCode":"// pick exactly one implementation before building\nif (useRuntimeValue) builder.runtime(rv); else builder.function(f);","typeGuard":null,"tryCatchPattern":"try {\n    builder.function(f);\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"Only one of\")) { /* remove conflicting setter */ }\n    else throw e;\n}","preventionTips":["Choose the implementation style first (runtime vs function vs assistantFunction) and set only one","Avoid chaining multiple implementation setters in the same expression","Centralize action creation in one helper class"],"tags":["quarkus","devui","jsonrpc","builder-validation"],"backgroundTag":"conflicting-builder-options","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}