{"record":{"id":"7bf4f18924714c24","repo":"keras-team/keras","slug":"inputs-should-be-a-list-received-inputs-input-7bf4f1","errorCode":null,"errorMessage":"`inputs` should be a list. Received: inputs={inputs}","messagePattern":"`inputs` should be a list\\. Received: inputs=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/merging/concatenate.py","lineNumber":128,"sourceCode":"                f\"Received: input_shape={input_shape}\"\n            )\n        input_shapes = input_shape\n        output_shape = list(input_shapes[0])\n\n        for shape in input_shapes[1:]:\n            if output_shape[self.axis] is None or shape[self.axis] is None:\n                output_shape[self.axis] = None\n                break\n            output_shape[self.axis] += shape[self.axis]\n        return tuple(output_shape)\n\n    def compute_mask(self, inputs, mask=None):\n        if mask is None:\n            return None\n        if not isinstance(mask, (tuple, list)):\n            raise ValueError(f\"`mask` should be a list. Received mask={mask}\")\n        if not isinstance(inputs, (tuple, list)):\n            raise ValueError(\n                f\"`inputs` should be a list. Received: inputs={inputs}\"\n            )\n        if len(mask) != len(inputs):\n            raise ValueError(\n                \"The lists `inputs` and `mask` should have the same length. \"\n                f\"Received: inputs={inputs} of length {len(inputs)}, and \"\n                f\"mask={mask} of length {len(mask)}\"\n            )\n        if all(m is None for m in mask):\n            return None\n        # Make a list of masks while making sure\n        # the dimensionality of each mask\n        # is the same as the corresponding input.\n        masks = []\n        for input_i, mask_i in zip(inputs, mask):\n            if mask_i is None:\n                # Input is unmasked. Append all 1s to masks,\n                masks.append(ops.ones_like(input_i, dtype=\"bool\"))","sourceCodeStart":110,"sourceCodeEnd":146,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/merging/concatenate.py#L110-L146","documentation":"Concatenate.compute_mask validates that inputs is a list/tuple when a mask is supplied. A single tensor input (or non-sequence) together with a mask argument triggers this error.","triggerScenarios":"compute_mask(x, mask=[m1, m2]) called with a bare tensor; custom subclasses forwarding unwrapped inputs to the parent implementation.","commonSituations":"Direct compute_mask calls in tests or shape utilities; custom merge subclasses with altered input arity.","solutions":["Always pass inputs as a list matching the layer's call structure","Mirror the exact input structure used in __call__ when calling compute_mask","Add a structure check in wrappers before delegating"],"exampleFix":"# before\nm = concat.compute_mask(x, mask=[m1, m2])\n\n# after\nm = concat.compute_mask([x1, x2], mask=[m1, m2])","handlingStrategy":"validation","validationCode":"assert isinstance(inputs, (list, tuple)), 'inputs must be a list when mask is given'","typeGuard":"def is_input_list(x) -> bool:\n    return isinstance(x, (list, tuple))","tryCatchPattern":null,"preventionTips":["Keep compute_mask call structure identical to __call__","Wrap inputs in lists in subclasses that override compute_mask"],"tags":["keras","concatenate","masking","input-format"],"backgroundTag":"wrong-argument-structure","analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}