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
- Read the 'Caused by' exception in the log to find the root cause inside the trigger
- Ensure the trigger class has a public no-arg constructor
- Test the trigger's augment() against the failing partition locally
- 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
- Unit-test ITrigger.augment against representative partitions
- Keep triggers simple and defensive (null-check partition contents)
- Re-test triggers after every Cassandra upgrade
- Avoid triggers for critical paths; prefer application-side augmentation
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
- CIDR group ' ' doesn't exists
- Counter mutations and trigger mutations cannot be applied…
- Error starting native transport:
- Failed to execute stress action
- Partition key of additional mutation does not match primary…
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)