{"record":{"id":"d42de0bccd21ef06","repo":"keras-team/keras","slug":"argument-name-must-be-a-string-and-cannot-contai-d42de0","errorCode":null,"errorMessage":"Argument `name` must be a string and cannot contain character `/`. Received: name={name}","messagePattern":"Argument `name` must be a string and cannot contain character `/`\\. Received: name=(.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"keras/src/backend/common/variables.py","lineNumber":109,"sourceCode":"    ```\n    \"\"\"\n\n    def __init__(\n        self,\n        initializer,\n        shape=None,\n        dtype=None,\n        trainable=True,\n        autocast=True,\n        aggregation=\"none\",\n        synchronization=\"auto\",\n        name=None,\n        layout=None,\n        **kwargs,\n    ):\n        name = name or auto_name(self.__class__.__name__)\n        if not isinstance(name, str) or \"/\" in name:\n            raise ValueError(\n                \"Argument `name` must be a string and \"\n                \"cannot contain character `/`. \"\n                f\"Received: name={name}\"\n            )\n        if aggregation not in (\n            None,\n            \"none\",\n            \"mean\",\n            \"sum\",\n            \"only_first_replica\",\n        ):\n            raise ValueError(\n                \"Invalid value for argument `aggregation`. Expected \"\n                \"one of `None`, `'none'`, `'mean'`, `'sum'`, \"\n                \"`'only_first_replica'`. \"\n                f\"Received: aggregation={aggregation}\"\n            )\n        if aggregation is None:","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/keras-team/keras/blob/7a34a03db60bf60042242d6a556fc3be119046a5/keras/src/backend/common/variables.py#L91-L127","documentation":"Raised in Variable.__init__ when the user-supplied name is not a string or contains '/'. Variable names become path segments in the global variable namespace where '/' separates scopes, so a slash inside one name would break path resolution; the check guards the name argument before creation.","triggerScenarios":"Thrown at keras/src/backend/common/variables.py:109 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a name string without '/' (use '-' or '_' instead)","Omit name to let Keras auto-generate a safe name","If hierarchical naming is wanted, use name_scope rather than embedding slashes in the name"],"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"}