{"record":{"id":"21667705c6f7b619","repo":"keras-team/keras","slug":"cannot-pass-none-at-locations-none-args-with-sig","errorCode":null,"errorMessage":"Cannot pass None at locations {none_args} with signature={signature}","messagePattern":"Cannot pass None at locations (.+?) with signature=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/common/backend_utils.py","lineNumber":624,"sourceCode":"\n    @functools.wraps(pyfunc)\n    def wrapped(*args, **kwargs):\n        excluded_func, args, kwargs = _vectorize_apply_excluded(\n            pyfunc, excluded, args, kwargs\n        )\n\n        if signature is not None:\n            input_core_dims, output_core_dims = (\n                _vectorize_parse_gufunc_signature(signature)\n            )\n        else:\n            input_core_dims = [()] * len(args)\n            output_core_dims = None\n\n        none_args = {i for i, arg in enumerate(args) if arg is None}\n        if any(none_args):\n            if any(input_core_dims[i] != () for i in none_args):\n                raise ValueError(\n                    f\"Cannot pass None at locations {none_args} \"\n                    f\"with signature={signature}\"\n                )\n            excluded_func, args, _ = _vectorize_apply_excluded(\n                excluded_func, none_args, args, {}\n            )\n            input_core_dims = [\n                dim\n                for i, dim in enumerate(input_core_dims)\n                if i not in none_args\n            ]\n\n        args = tuple(map(ops.convert_to_tensor, args))\n\n        broadcast_shape, dim_sizes = _vectorize_parse_input_dimensions(\n            args, input_core_dims\n        )\n        checked_func = _vectorize_check_output_dims(","sourceCodeStart":606,"sourceCodeEnd":642,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/common/backend_utils.py#L606-L642","documentation":"Guard in the vectorize wrapper: None was passed for argument positions whose signature declares non-empty core dimensions. A None carries no shape, so its core dims cannot be parsed; the vectorization machinery only tolerates None where the signature expects a scalar '()'.","triggerScenarios":"Thrown at keras/src/backend/common/backend_utils.py:624 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a real tensor (e.g. zeros of the right shape) instead of None at those positions.","Add those argument indices to excluded so they bypass signature parsing.","Declare '()' core dims for optional arguments and handle None inside the wrapped function."],"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"}