apache/cassandra · error · RuntimeException

Exception while executing trigger on table with ID

Error message

Exception while executing trigger on table with ID: %s

What it means

Any exception other than ClassNotFoundException thrown while evaluating a trigger's ITrigger.augment (including instantiation and trigger execution failures) is wrapped in a RuntimeException carrying the table ID in this message, preserving the cause.

Solutions

  1. Read the 'Caused by' exception in the log to find the root cause inside the trigger
  2. Ensure the trigger class has a public no-arg constructor
  3. Test the trigger's augment() against the failing partition locally
  4. Fix or remove the trigger

Example fix

// before
public class MyTrigger implements ITrigger {
    private MyTrigger() {}
}
// after
public class MyTrigger implements ITrigger {
    public MyTrigger() {} // must be public no-arg
}
Defensive patterns

Strategy: try-catch

Validate before calling

// before deploying, ensure trigger has a public no-arg constructor
Class<?> c = Class.forName("com.example.MyTrigger");
if (!java.lang.reflect.Modifier.isPublic(c.getDeclaredConstructor().getModifiers()))
    throw new IllegalStateException("ITrigger must have a public no-arg constructor");

Try / catch

// inspect the cause chain of the wrapped RuntimeException from server logs
try {
    session.execute(insert);
} catch (RuntimeException e) {
    Throwable root = e; while (root.getCause() != null) root = root.getCause();
    log.error("Trigger failed: {}", root);
}

Prevention

When it happens

Trigger: A trigger's ITrigger.augment(Partition) throws (NPE, unsupported partition shape, internal error), or loadTriggerInstance throws TriggerDisabledException / reflective instantiation failures (no public no-arg constructor) during mutation execution.

Common situations: Custom trigger code buggy after a Cassandra upgrade; trigger class lacks a public no-argument constructor; trigger fails on specific partition data.

Related errors


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/8f0d8c9a34203e19. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/triggers/TriggerExecutor.java:281

                    cachedTriggers.put(td.classOption, trigger);
                }
                Collection<Mutation> temp = trigger.augment(update);
                if (temp != null)
                    tmutations.addAll(temp);
            }
            return tmutations;
        }
        catch (CassandraException ex)
        {
            throw ex;
        }
        catch (ClassNotFoundException ex)
        {
            throw new ConfigurationException("Trigger class " + triggerClass + " couldn't be found.");
        }
        catch (Exception ex)
        {
            throw new RuntimeException(String.format("Exception while executing trigger on table with ID: %s", update.metadata().id), ex);
        }
        finally
        {
            Thread.currentThread().setContextClassLoader(parent);
        }
    }

    public synchronized Class<? extends ITrigger> loadTriggerClass(String triggerClass) throws Exception
    {
        // Allow loading the class regardless of Config, since this could happen as part of TCM replay via
        // CreateTriggerStatement#apply.
        // Check that triggerClass is available on the classpath, but do not initialize the class since that would
        // execute static blocks.
        Class<? extends ITrigger> trigger = loadTriggerClassWithoutInitialization(triggerClass);
        // Validate that the class exposes a public no-argument constructor before it is accepted.
        trigger.getConstructor();
        return trigger;
    }

View on GitHub (pinned to 88fd0f6a0e)