{"record":{"id":"b893c7647692639f","repo":"apache/cassandra","slug":"refusing-to-load-new-trigger-class-s-with-trigger","errorCode":null,"errorMessage":"Refusing to load new trigger class %s with TriggersPolicy.%s","messagePattern":"Refusing to load new trigger class (.+?) with TriggersPolicy\\.(.+?)","errorType":"exception","errorClass":"TriggerDisabledException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/triggers/TriggerExecutor.java","lineNumber":323,"sourceCode":"            return FBUtilities.classForNameWithoutInitialization(triggerClass,\n                                                                 \"trigger\",\n                                                                 ITrigger.class,\n                                                                 customClassLoader);\n        }\n        catch (ConfigurationException e)\n        {\n            if (e.getCause() instanceof ClassNotFoundException)\n                throw (ClassNotFoundException) e.getCause();\n            throw e;\n        }\n    }\n\n    public synchronized ITrigger loadTriggerInstance(String triggerClass) throws Exception\n    {\n        Config.TriggersPolicy policy = DatabaseDescriptor.getTriggersPolicy();\n        if (policy == Config.TriggersPolicy.disabled || policy == Config.TriggersPolicy.forbidden)\n        {\n            throw new TriggerDisabledException(String.format(\"Refusing to load new trigger class %s with TriggersPolicy.%s\", triggerClass, policy));\n        }\n\n        // double check.\n        if (cachedTriggers.get(triggerClass) != null)\n            return cachedTriggers.get(triggerClass);\n        return loadTriggerClassWithoutInitialization(triggerClass).getConstructor().newInstance();\n    }\n}\n","sourceCodeStart":305,"sourceCodeEnd":332,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/triggers/TriggerExecutor.java#L305-L332","documentation":"loadTriggerInstance refuses to instantiate a new trigger class when the cluster's triggers_policy is set to disabled or forbidden, throwing TriggerDisabledException (a ConfigurationException). Only NEW trigger class loads are blocked; cached triggers may still be present.","triggerScenarios":"cassandra.yaml sets triggers_policy: disabled or forbidden and a mutation invokes a table with a trigger whose class has not yet been loaded/cached in this process.","commonSituations":"Operators hardening clusters disable triggers but a schema with triggers remains; config synced from a hardened cluster to one with trigger-based workflows.","solutions":["Remove the trigger definitions from the schema (DROP TRIGGER) if policy should stay disabled","Set triggers_policy: enabled in cassandra.yaml and restart if triggers are required","Note existing cached trigger instances may still execute until restart","Use 'blocked' policy if you only want to prevent loading new triggers dynamically"],"exampleFix":"// before (cassandra.yaml)\ntriggers_policy: forbidden\n// after\ntriggers_policy: enabled","handlingStrategy":"validation","validationCode":"// check policy before relying on triggers\nConfig.TriggersPolicy policy = DatabaseDescriptor.getTriggersPolicy();\nif (policy == Config.TriggersPolicy.disabled || policy == Config.TriggersPolicy.forbidden)\n    throw new IllegalStateException(\"Triggers disabled by policy; DROP TRIGGER or set triggers_policy: enabled\");","typeGuard":null,"tryCatchPattern":"try {\n    session.execute(write);\n} catch (org.apache.cassandra.exceptions.ConfigurationException e) {\n    if (e.getMessage().startsWith(\"Refusing to load new trigger class\")) {\n        // enable triggers or remove trigger definitions\n    } else throw e;\n}","preventionTips":["Align triggers_policy with schema: no triggers in schema when policy is disabled/forbidden","Audit cassandra.yaml across environments for policy drift","Remember cached trigger instances can persist until restart after policy changes"],"tags":["triggers","configuration","policy"],"backgroundTag":"feature-not-enabled","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}