{"record":{"id":"e841f66a0d307818","repo":"quarkusio/quarkus","slug":"the-cause-of-an-inactive-result-must-also-be-inact","errorCode":null,"errorMessage":"The cause of an inactive result must also be inactive","messagePattern":"The cause of an inactive result must also be inactive","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ActiveResult.java","lineNumber":49,"sourceCode":"     * @return the inactive result\n     */\n    public static ActiveResult inactive(String reason) {\n        return new ActiveResult(false, Objects.requireNonNull(reason), null);\n    }\n\n    /**\n     * The synthetic bean is question is inactive for given {@code reason}.\n     * The given {@code cause} is an {@link ActiveResult} for an underlying bean\n     * that is inactive and causes this bean to also become inactive.\n     *\n     * @param reason the reason why the synthetic bean is inactive; must not be {@code null}\n     * @param cause the cause why the synthetic bean is inactive; may be {@code null},\n     *        but when it is not, it must be inactive as well\n     * @return the inactive result with a cause\n     */\n    public static ActiveResult inactive(String reason, ActiveResult cause) {\n        if (cause != null && cause.value) {\n            throw new IllegalArgumentException(\"The cause of an inactive result must also be inactive\");\n        }\n        return new ActiveResult(false, Objects.requireNonNull(reason), cause);\n    }\n\n    private ActiveResult(boolean value, String inactiveReason, ActiveResult inactiveCause) {\n        this.value = value;\n        this.inactiveReason = inactiveReason;\n        this.inactiveCause = inactiveCause;\n    }\n\n    /**\n     * Returns whether the synthetic bean in question is active.\n     *\n     * @return whether the synthetic bean in question is active\n     */\n    public boolean value() {\n        return value;\n    }","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/independent-projects/arc/runtime/src/main/java/io/quarkus/arc/ActiveResult.java#L31-L67","documentation":"ActiveResult models why a synthetic bean is currently inactive; an inactive result may optionally point to a cause, but that cause must itself be inactive (its value must be false). ActiveResult.inactive(reason, cause) throws IllegalArgumentException when a non-null cause reports value == true, preventing an internally inconsistent chain that would misrepresent activation state.","triggerScenarios":"Programmatically building an inactive ActiveResult (typically in custom synthetic bean/invoker handling) and passing an ActiveResult that was constructed with value=true (an 'active' result) as the cause argument.","commonSituations":"Chaining results from multiple activation checks and passing the wrong variable; caching a shared ActiveResult whose flag flipped; hand-rolling an ActiveResult via the private constructor path or a public factory misuse.","solutions":["Pass null as the cause when there is no inactive reason to chain.","Ensure the cause is created via ActiveResult.inactive(...) so it is guaranteed to be inactive.","Log or inspect the cause result's value before passing it; only forward results known to represent inactivity.","Check library versions — if you believe the cause is inactive but it reports active, verify the code that produced it."],"exampleFix":"// before\nActiveResult result = ActiveResult.inactive(\"bean disabled\", activeResult);\n\n// after\nActiveResult result = ActiveResult.inactive(\"bean disabled\",\n        ActiveResult.inactive(\"upstream dependency disabled\", null));","handlingStrategy":"type-guard","validationCode":"if (cause != null && cause.isActive()) {\n    cause = null; // or rebuild as inactive before calling ActiveResult.inactive(reason, cause)\n}","typeGuard":"static ActiveResult asInactiveCause(ActiveResult r) {\n    return (r != null && !r.isActive()) ? r : null;\n}","tryCatchPattern":"try {\n    return ActiveResult.inactive(reason, cause);\n} catch (IllegalArgumentException e) {\n    return ActiveResult.inactive(reason, null);\n}","preventionTips":["Only ever pass results produced by ActiveResult.inactive(...) as causes.","Never cache and reuse ActiveResult instances whose active flag may change.","Add an assertion in result-producing code that chained causes are inactive."],"tags":["arc","cdi","synthetic-bean","quarkus"],"backgroundTag":"invalid-inactive-result-cause","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"}