{"record":{"id":"e3bf408fd0425f22","repo":"nathanmarz/storm","slug":"tuple-created-with-wrong-number-of-fields-expected-schema","errorCode":null,"errorMessage":"Tuple created with wrong number of fields. Expected ${schema.size()} fields but got ${values.size()} fields","messagePattern":"Tuple created with wrong number of fields\\. Expected (.+?) fields but got (.+?) fields","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"storm-core/src/jvm/backtype/storm/tuple/TupleImpl.java","lineNumber":55,"sourceCode":"public class TupleImpl extends IndifferentAccessMap implements Seqable, Indexed, IMeta, Tuple {\n    private List<Object> values;\n    private int taskId;\n    private String streamId;\n    private GeneralTopologyContext context;\n    private MessageId id;\n    private IPersistentMap _meta = null;\n    \n    public TupleImpl(GeneralTopologyContext context, List<Object> values, int taskId, String streamId, MessageId id) {\n        this.values = values;\n        this.taskId = taskId;\n        this.streamId = streamId;\n        this.id = id;\n        this.context = context;\n        \n        String componentId = context.getComponentId(taskId);\n        Fields schema = context.getComponentOutputFields(componentId, streamId);\n        if(values.size()!=schema.size()) {\n            throw new IllegalArgumentException(\n                    \"Tuple created with wrong number of fields. \" +\n                    \"Expected \" + schema.size() + \" fields but got \" +\n                    values.size() + \" fields\");\n        }\n    }\n\n    public TupleImpl(GeneralTopologyContext context, List<Object> values, int taskId, String streamId) {\n        this(context, values, taskId, streamId, MessageId.makeUnanchored());\n    }    \n    \n    Long _processSampleStartTime = null;\n    Long _executeSampleStartTime = null;\n    \n    public void setProcessSampleStartTime(long ms) {\n        _processSampleStartTime = ms;\n    }\n\n    public Long getProcessSampleStartTime() {","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-core/src/jvm/backtype/storm/tuple/TupleImpl.java#L37-L73","documentation":"Thrown in the TupleImpl constructor when the values list length does not match the declared output schema size of the stream the tuple is being created for. Storm validates at tuple-creation time that every tuple conforms to the component's declared fields, so this error indicates an emit call is producing the wrong number of values for the stream.","triggerScenarios":"Thrown at storm-core/src/jvm/backtype/storm/tuple/TupleImpl.java:55 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Make the number of values passed to emit match the fields declared for that output stream (e.g. declare(new Fields(\"a\",\"b\")) requires exactly 2 values).","If the tuple shape changed, update the OutputFieldsDeclarer declaration to reflect the new schema.","Check for emitting to the wrong stream, where a different schema size is expected.","Count tuple values dynamically and pad/trim intentionally rather than relying on accidental list lengths."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}