{"record":{"id":"7316c0b934cd3a33","repo":"keras-team/keras","slug":"illegal-none-dimension-in-x-with-shape-x-shape","errorCode":null,"errorMessage":"Illegal None dimension in {x} with shape {x.shape}","messagePattern":"Illegal None dimension in (.+?) with shape (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/jax/export.py","lineNumber":159,"sourceCode":"    def _to_polymorphic_shape(self, struct, allow_none=True):\n        if allow_none:\n            # Generates unique names: a, b, ... z, aa, ab, ... az, ba, ... zz\n            # for unknown non-batch dims. Defined here to be scope per endpoint.\n            dim_names = itertools.chain(\n                string.ascii_lowercase,\n                itertools.starmap(\n                    lambda a, b: a + b,\n                    itertools.product(string.ascii_lowercase, repeat=2),\n                ),\n            )\n\n        def convert_shape(x):\n            poly_shape = []\n            for index, dim in enumerate(list(x.shape)):\n                if dim is not None:\n                    poly_shape.append(str(dim))\n                elif not allow_none:\n                    raise ValueError(\n                        f\"Illegal None dimension in {x} with shape {x.shape}\"\n                    )\n                elif index == 0:\n                    poly_shape.append(\"batch\")\n                else:\n                    poly_shape.append(next(dim_names))\n            return f\"({', '.join(poly_shape)})\"\n\n        return tree.map_structure(convert_shape, struct)\n\n    def _check_device_compatible(self):\n        from jax import default_backend as jax_device\n\n        if (\n            jax_device() == \"gpu\"\n            and len(tf.config.list_physical_devices(\"GPU\")) == 0\n        ):\n            warnings.warn(","sourceCodeStart":141,"sourceCodeEnd":177,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/jax/export.py#L141-L177","documentation":"Error \"Illegal None dimension in {x} with shape {x.shape}\" thrown in keras-team/keras.","triggerScenarios":"Thrown at keras/src/backend/jax/export.py:159 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"}