{"record":{"id":"0871b744fd2ef668","repo":"keras-team/keras","slug":"invalid-type-for-argument-axes-it-should-be-a-l","errorCode":null,"errorMessage":"Invalid type for argument `axes`: it should be a list or an int. Received: axes={axes}","messagePattern":"Invalid type for argument `axes`: it should be a list or an int\\. Received: axes=(.+?)","errorType":"validation","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/merging/dot.py","lineNumber":246,"sourceCode":"            corresponding to the desired axis from the first input and the\n            desired axis from the second input, respectively. Note that the\n            size of the two selected axes must match, and that\n            axis `0` (the batch axis) cannot be included.\n        normalize: Whether to L2-normalize samples along the dot product axis\n            before taking the dot product. If set to `True`, then\n            the output of the dot product is the cosine proximity\n            between the two samples.\n        **kwargs: Standard layer keyword arguments.\n\n    Returns:\n        A tensor, the dot product of the samples from the inputs.\n    \"\"\"\n\n    def __init__(self, axes, normalize=False, **kwargs):\n        super().__init__(**kwargs)\n        if not isinstance(axes, int):\n            if not isinstance(axes, (list, tuple)):\n                raise TypeError(\n                    f\"Invalid type for argument `axes`: it should be \"\n                    f\"a list or an int. Received: axes={axes}\"\n                )\n            if len(axes) != 2:\n                raise ValueError(\n                    f\"Invalid format for argument `axes`: it should contain \"\n                    f\"two elements. Received: axes={axes}\"\n                )\n            if not isinstance(axes[0], int) or not isinstance(axes[1], int):\n                raise ValueError(\n                    f\"Invalid format for argument `axes`: list elements should \"\n                    f\"be integers. Received: axes={axes}\"\n                )\n        self.axes = axes\n        self.normalize = normalize\n        self.supports_masking = True\n        self._reshape_required = False\n","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/merging/dot.py#L228-L264","documentation":"Input validation in Dot.__init__: the `axes` constructor argument must be an int or a list/tuple; anything else (string, dict, None, float) is a type error at this guard because no axis interpretation exists for it.","triggerScenarios":"Thrown at keras/src/layers/merging/dot.py:246 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass axes as an int, e.g. axes=-1, or a 2-element list/tuple like axes=[2, 2]","If axes comes from a config file, cast it to int or list before constructing the layer","Leave axes out entirely when defaulting to int(-1) is acceptable"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}