nathanmarz/storm · error · IllegalArgumentException
Unknown field name:
Error message
Unknown field name:
What it means
MockTridentTuple (test helper) looks up field values via an index built from the declared fields. getIndex throws IllegalArgumentException when the requested field name is not in the mock tuple's field map.
Solutions
- Align the mock tuple's fields with the topology's actual output fields
- Fix the field-name typo in the test assertion
- Use Testing.parseTuple / completeTopology outputs that carry the real fields
Example fix
// before
MockTridentTuple tuple = new MockTridentTuple(new Fields("a"), Arrays.asList(1));
tuple.getValueByField("b");
// after
MockTridentTuple tuple = new MockTridentTuple(new Fields("a", "b"), Arrays.asList(1, 2));
tuple.getValueByField("b"); Defensive patterns
Strategy: validation
Validate before calling
if (!mockTuple.getFields().contains(fieldName)) {
// fix fixture: field not declared on mock tuple
} Try / catch
try {
Object v = mockTuple.getValueByField("count");
} catch (IllegalArgumentException e) {
if (e.getMessage().startsWith("Unknown field name")) {
fail("Test fixture fields do not match topology output: " + e.getMessage());
}
throw e;
} Prevention
- Generate test tuples from the topology's real output fields (Testing.getFields)
- Update test fixtures whenever stream fields are renamed
- Assert on field index (getValue) only with a validated fields list
When it happens
Trigger: Calling getValueByField("name") on a MockTridentTuple built with a Fields list that doesn't include "name" — usually a typo or fields not registered in the mock's constructor/completeTopology output.
Common situations: Unit-testing Trident topologies where the mock's declared fields diverge from the real topology output; renaming a stream field without updating test fixtures.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- Output fields for chained aggregators must be distinct
- Combiner aggs only take a single field as input. Got this…
- Additive operations cannot add fields with same name as…
- Fields order must be same length as pointers map
- duplicate field
AI-assisted analysis of nathanmarz/storm@cdb116e942 (2026-09-12).
Data as JSON: /api/errors/432d7d611b6ffc61.
Report an issue: GitHub.
Appendix: source
Thrown at storm-core/src/jvm/storm/trident/testing/MockTridentTuple.java:57
public MockTridentTuple(List<String> fieldName, Object... values) {
super(Arrays.asList(values));
fieldMap = setupFieldMap(fieldName);
}
private Map<String, Integer> setupFieldMap(List<String> fieldNames) {
Map<String, Integer> newFieldMap = new HashMap<String, Integer>(fieldNames.size());
int idx = 0;
for (String fieldName : fieldNames) {
newFieldMap.put(fieldName, idx++);
}
return newFieldMap;
}
private int getIndex(String fieldName) {
Integer index = fieldMap.get(fieldName);
if (index == null) {
throw new IllegalArgumentException("Unknown field name: " + fieldName);
}
return index;
}
@Override
public List<Object> getValues() {
return this;
}
@Override
public Object getValue(int i) {
return get(i);
}
@Override
public String getString(int i) {
return (String)get(i);
}View on GitHub (pinned to cdb116e942)