{"record":{"id":"57bfdcc4ad813250","repo":"keras-team/keras","slug":"argument-cell-should-have-a-call-method-recei","errorCode":null,"errorMessage":"Argument `cell` should have a `call` method. Received: cell={cell}","messagePattern":"Argument `cell` should have a `call` method\\. Received: cell=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/layers/rnn/rnn.py","lineNumber":188,"sourceCode":"    y = layer(x)\n    ```\n    \"\"\"\n\n    def __init__(\n        self,\n        cell,\n        return_sequences=False,\n        return_state=False,\n        go_backwards=False,\n        stateful=False,\n        unroll=False,\n        zero_output_for_mask=False,\n        **kwargs,\n    ):\n        if isinstance(cell, (list, tuple)):\n            cell = StackedRNNCells(cell)\n        if \"call\" not in dir(cell):\n            raise ValueError(\n                \"Argument `cell` should have a `call` method. \"\n                f\"Received: cell={cell}\"\n            )\n        if \"state_size\" not in dir(cell):\n            raise ValueError(\n                \"The RNN cell should have a `state_size` attribute \"\n                \"(single integer or list of integers, \"\n                \"one integer per RNN state). \"\n                f\"Received: cell={cell}\"\n            )\n        super().__init__(**kwargs)\n\n        # If True, the output for masked timestep will be zeros, whereas in the\n        # False case, output from previous timestep is returned for masked\n        # timestep.\n        self.zero_output_for_mask = zero_output_for_mask\n        self.cell = cell\n        self.return_sequences = return_sequences","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/layers/rnn/rnn.py#L170-L206","documentation":"Raised by RNN.__init__ when the `cell` object has no `call` attribute. The RNN layer steps the cell by calling it each timestep, so anything without a callable call method (a plain function without call, a number, a string) fails this duck-typing check.","triggerScenarios":"Thrown at keras/src/layers/rnn/rnn.py:188 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a proper RNN cell such as SimpleRNNCell(10), GRUCell(10), or LSTMCell(10)","Wrap a list of cells for stacked RNNs: RNN([cell1, cell2])","For custom cells, implement a call(self, inputs, states) method"],"exampleFix":null,"handlingStrategy":"validation","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"}