nathanmarz/storm · error · UnsupportedOperationException
Trident does not support direct streams
Error message
Trident does not support direct streams
What it means
RichSpoutBatchExecutor wraps a regular IRichSpout for Trident batch spouts and replaces its output collector with one whose emitDirect throws UnsupportedOperationException. Trident topology semantics (grouping, batching) do not support direct stream connections, so any attempt to emit directly from a wrapped spout fails immediately.
Solutions
- Replace all emitDirect calls in the spout with normal collector.emit(values).
- If direct grouping is required, keep the spout in a plain (non-Trident) Storm topology instead.
- Wrap the emit logic: use emit with partialKeyGrouping/shuffle groupings that Trident supports.
- Audit third-party spout libraries for direct emit usage before embedding them in Trident.
Example fix
// before if (taskIndex == target) collector.emitDirect(target, stream, values, msgId); else collector.emit(stream, values, msgId); // after: Trident supports only indirect emits collector.emit(stream, values, msgId);
Defensive patterns
Strategy: validation
Validate before calling
// Java: audit spout code for direct emits before embedding in Trident // grep your spout source for: // collector.emitDirect( -> must be absent in spouts used with Trident
Prevention
- Never use emitDirect in spouts intended for Trident topologies
- Check third-party spout libraries for direct-grouping reliance
- Add a smoke test that runs the spout under Trident in local mode
When it happens
Trigger: Using a spout that calls collector.emitDirect(...) (e.g. a partial-key-grouping or direct-grouping spout) inside a Trident topology via TridentTopology.newStream, then the spout attempts a direct emit at runtime.
Common situations: Migrating an existing raw Storm spout into Trident without removing direct emits; third-party spouts that rely on direct grouping; copying spout code that uses emitDirect for backpressure or targeted delivery.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- Trident does not support direct emits from spouts
- Regular rich spouts not supported yet... try wrapping in a…
- This state is read-only and does not support updates
- Trying to select non-existent field
- Cannot join DRPC stream with streams originating from other…
AI-assisted analysis of nathanmarz/storm@cdb116e942 (2026-09-12).
Data as JSON: /api/errors/7cf4fe863d8bc744.
Report an issue: GitHub.
Appendix: source
Thrown at storm-core/src/jvm/storm/trident/spout/RichSpoutBatchExecutor.java:193
ids = new ArrayList<Object>();
}
@Override
public void reportError(Throwable t) {
_collector.reportError(t);
}
@Override
public List<Integer> emit(String stream, List<Object> values, Object id) {
if(id!=null) ids.add(id);
numEmitted++;
_collector.emit(values);
return null;
}
@Override
public void emitDirect(int task, String stream, List<Object> values, Object id) {
throw new UnsupportedOperationException("Trident does not support direct streams");
}
}
}
View on GitHub (pinned to cdb116e942)