{"record":{"id":"2cd414b5e2fd11b6","repo":"quarkusio/quarkus","slug":"attempting-to-boot-a-deactivated-hibernate-reactiv","errorCode":null,"errorMessage":"Attempting to boot a deactivated Hibernate Reactive persistence unit","messagePattern":"Attempting to boot a deactivated Hibernate Reactive persistence unit","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/FastBootHibernateReactivePersistenceProvider.java","lineNumber":191,"sourceCode":"            if (!isProvider(persistenceUnit)) {\n                log.debug(\"Excluding from consideration due to provider mismatch\");\n                continue;\n            }\n\n            RecordedState recordedState = PersistenceUnitsHolder.popRecordedState(persistenceUnitName, true);\n\n            final PrevalidatedQuarkusMetadata metadata = recordedState.getMetadata();\n            final BuildTimeSettings buildTimeSettings = recordedState.getBuildTimeSettings();\n            final IntegrationSettings integrationSettings = recordedState.getIntegrationSettings();\n            RuntimeSettings.Builder runtimeSettingsBuilder = new RuntimeSettings.Builder(buildTimeSettings,\n                    integrationSettings);\n            SchemaToolingUtil.PreparedImportScripts importScripts = unzipZipFilesAndReplaceZipsInImportFiles(\n                    runtimeSettingsBuilder);\n\n            HibernateOrmRuntimeConfigPersistenceUnit persistenceUnitConfig = hibernateOrmRuntimeConfig.persistenceUnits()\n                    .get(persistenceUnit.getName());\n            if (persistenceUnitConfig.active().isPresent() && !persistenceUnitConfig.active().get()) {\n                throw new IllegalStateException(\n                        \"Attempting to boot a deactivated Hibernate Reactive persistence unit\");\n            }\n\n            // Inject runtime configuration if the persistence unit was defined by Quarkus configuration\n            if (!recordedState.isFromPersistenceXml()) {\n                injectRuntimeConfiguration(persistenceUnitConfig, runtimeSettingsBuilder);\n            }\n\n            for (HibernateOrmIntegrationRuntimeDescriptor descriptor : integrationRuntimeDescriptors\n                    .getOrDefault(persistenceUnitName, Collections.emptyList())) {\n                Optional<HibernateOrmIntegrationRuntimeInitListener> listenerOptional = descriptor.getInitListener();\n                if (listenerOptional.isPresent()) {\n                    listenerOptional.get().contributeRuntimeProperties(runtimeSettingsBuilder::put);\n                }\n            }\n\n            boolean startsOffline = persistenceUnitConfig.database().startOffline();\n","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/extensions/hibernate-reactive/runtime/src/main/java/io/quarkus/hibernate/reactive/runtime/FastBootHibernateReactivePersistenceProvider.java#L173-L209","documentation":"A persistence unit marked inactive at runtime (quarkus.hibernate-orm.\"name\".active=false) must not be booted. If code still tries to obtain an EntityManagerFactory for it, Quarkus throws IllegalStateException to prevent using a deactivated PU.","triggerScenarios":"quarkus.hibernate-orm.\"<pu>\".active=false (or quarkus.hibernate-orm.active=false) is set in configuration, and application code calls Persistence.createEntityManagerFactory for that PU, triggering getEntityManagerFactoryBuilderOrNull in FastBootHibernateReactivePersistenceProvider.","commonSituations":"Dev/test profiles disabling a PU (e.g., to avoid DB connection) while tests still touch it; environment-specific config deactivating the default PU; programmatically checking/iterating over all PUs including inactive ones.","solutions":["Set quarkus.hibernate-orm.\"<pu>\".active=true for the profile where the PU is needed","Guard code that touches the PU with the runtime config active() check before booting","If PU is intentionally off, remove/rename it rather than leaving it inactive and referenced","Check which profile (dev/test/prod) sets active=false"],"exampleFix":"// before\nquarkus.hibernate-orm.reporting.active=false\n\n// after (enable it, or guard usage)\nquarkus.hibernate-orm.reporting.active=true\n// or in code:\nif (config.persistenceUnits().get(\"reporting\").active().orElse(true)) { bootPu(); }","handlingStrategy":"validation","validationCode":"HibernateOrmRuntimeConfig cfg = /* injected */;\nHibernateOrmRuntimeConfigPersistenceUnit pu = cfg.persistenceUnits().get(\"reporting\");\nif (pu != null && pu.active().isPresent() && !pu.active().get()) {\n    return; // skip boot\n}","typeGuard":"boolean isActive(HibernateOrmRuntimeConfigPersistenceUnit pu) {\n    return pu == null || pu.active().orElse(true);\n}","tryCatchPattern":"try {\n    return Persistence.createEntityManagerFactory(puName);\n} catch (IllegalStateException e) {\n    if (e.getMessage().contains(\"deactivated\")) { return null; /* intentionally disabled */ }\n    throw e;\n}","preventionTips":["Check quarkus.hibernate-orm.\"pu\".active per profile before booting PUs manually","Avoid disabling PUs in profiles that still reference them","Guard PU-touching code behind the runtime config active() flag"],"tags":["hibernate-reactive","persistence-unit","deactivated","config"],"backgroundTag":"persistence-unit-deactivated","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"}