{"record":{"id":"ee9eebb41bce5fc3","repo":"keras-team/keras","slug":"expected-model-argument-to-be-a-functional-model","errorCode":null,"errorMessage":"Expected `model` argument to be a Functional Model instance. Received: model={model}","messagePattern":"Expected `model` argument to be a Functional Model instance\\. Received: model=(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/models/cloning.py","lineNumber":375,"sourceCode":"            to build the model upon. If not provided,\n            placeholders will be created.\n        clone_function: callable to be applied on non-input layers in the model.\n            By default, it clones the layer (without copying the weights).\n\n    Returns:\n        An instance of `Functional` reproducing the behavior\n        of the original model, on top of new inputs tensors,\n        using newly instantiated weights.\n    \"\"\"\n\n    if not callable(clone_function):\n        raise ValueError(\n            \"Expected `clone_function` argument to be a callable. \"\n            f\"Received: clone_function={clone_function}\"\n        )\n\n    if not isinstance(model, Functional):\n        raise ValueError(\n            \"Expected `model` argument \"\n            f\"to be a Functional Model instance. Received: model={model}\"\n        )\n\n    if input_tensors is not None:\n        if not all(\n            isinstance(x, backend.KerasTensor)\n            for x in tree.flatten(input_tensors)\n        ):\n            raise ValueError(\n                \"All entries in `input_tensors` must be KerasTensors. \"\n                f\"Received invalid values: inputs_tensors={input_tensors}\"\n            )\n        try:\n            tree.assert_same_structure(input_tensors, model.input)\n        except ValueError as e:\n            raise ValueError(\n                \"`input_tensors` must have the same structure as model.input\"","sourceCodeStart":357,"sourceCodeEnd":393,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/models/cloning.py#L357-L393","documentation":"Error \"Expected `model` argument to be a Functional Model instance. Received: model={model}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/models/cloning.py:375 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7a34a03db60bf60042242d6a556fc3be119046a5","analyzedAt":"2026-08-25T21:25:25.994Z","schemaVersion":2},"datasetVersion":"2026-08-26T02:17:13.382Z"}