{"record":{"id":"432d7d611b6ffc61","repo":"nathanmarz/storm","slug":"unknown-field-name","errorCode":null,"errorMessage":"Unknown field name: ","messagePattern":"Unknown field name: ","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"storm-core/src/jvm/storm/trident/testing/MockTridentTuple.java","lineNumber":57,"sourceCode":"  public MockTridentTuple(List<String> fieldName, Object... values) {\n    super(Arrays.asList(values));\n    fieldMap = setupFieldMap(fieldName);\n  }\n\n  private Map<String, Integer> setupFieldMap(List<String> fieldNames) {\n    Map<String, Integer> newFieldMap = new HashMap<String, Integer>(fieldNames.size());\n\n    int idx = 0;\n    for (String fieldName : fieldNames) {\n      newFieldMap.put(fieldName, idx++);\n    }\n    return newFieldMap;\n  }\n\n  private int getIndex(String fieldName) {\n    Integer index = fieldMap.get(fieldName);\n    if (index == null) {\n      throw new IllegalArgumentException(\"Unknown field name: \" + fieldName);\n    }\n    return index;\n  }\n\n  @Override\n  public List<Object> getValues() {\n    return this;\n  }\n\n  @Override\n  public Object getValue(int i) {\n    return get(i);\n  }\n\n  @Override\n  public String getString(int i) {\n    return (String)get(i);\n  }","sourceCodeStart":39,"sourceCodeEnd":75,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-core/src/jvm/storm/trident/testing/MockTridentTuple.java#L39-L75","documentation":"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.","triggerScenarios":"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.","commonSituations":"Unit-testing Trident topologies where the mock's declared fields diverge from the real topology output; renaming a stream field without updating test fixtures.","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"],"exampleFix":"// before\nMockTridentTuple tuple = new MockTridentTuple(new Fields(\"a\"), Arrays.asList(1));\ntuple.getValueByField(\"b\");\n// after\nMockTridentTuple tuple = new MockTridentTuple(new Fields(\"a\", \"b\"), Arrays.asList(1, 2));\ntuple.getValueByField(\"b\");","handlingStrategy":"validation","validationCode":"if (!mockTuple.getFields().contains(fieldName)) {\n  // fix fixture: field not declared on mock tuple\n}","typeGuard":null,"tryCatchPattern":"try {\n  Object v = mockTuple.getValueByField(\"count\");\n} catch (IllegalArgumentException e) {\n  if (e.getMessage().startsWith(\"Unknown field name\")) {\n    fail(\"Test fixture fields do not match topology output: \" + e.getMessage());\n  }\n  throw e;\n}","preventionTips":["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"],"tags":["storm","trident","testing","fields"],"backgroundTag":"record-not-found","analyzedSha":"cdb116e942666973bc4eaa0df098d5bab82739e7","analyzedAt":"2026-09-12T14:30:00.714Z","contentChangedAt":"2026-09-12T14:30:00.714Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}