{"record":{"id":"c00f08a689bca8c7","repo":"tensorflow/models","slug":"collection-path-at-position-already-register","errorCode":null,"errorMessage":"Collection path {} at position {} already registered as a function or class.","messagePattern":"Collection path (.+?) at position (.+?) already registered as a function or class\\.","errorType":"exception","errorClass":"KeyError","httpStatus":null,"severity":"error","filePath":"official/core/registry.py","lineNumber":48,"sourceCode":"      put into this collection.\n    reg_key: The key for retrieving the registered function or class. If reg_key\n      is a string, it can be hierarchical like my_model/my_exp/my_config_0\n  Returns:\n    A decorator function\n  Raises:\n    KeyError: when function or class to register already exists.\n  \"\"\"\n  def decorator(fn_or_cls):\n    \"\"\"Put fn_or_cls in the dictionary.\"\"\"\n    if isinstance(reg_key, str):\n      hierarchy = reg_key.split(\"/\")\n      collection = registered_collection\n      for h_idx, entry_name in enumerate(hierarchy[:-1]):\n        if entry_name not in collection:\n          collection[entry_name] = {}\n        collection = collection[entry_name]\n        if not isinstance(collection, dict):\n          raise KeyError(\n              \"Collection path {} at position {} already registered as \"\n              \"a function or class.\".format(entry_name, h_idx))\n      leaf_reg_key = hierarchy[-1]\n    else:\n      collection = registered_collection\n      leaf_reg_key = reg_key\n\n    if leaf_reg_key in collection:\n      raise KeyError(\"Function or class {} registered multiple times.\".format(\n          leaf_reg_key))\n\n    collection[leaf_reg_key] = fn_or_cls\n    return fn_or_cls\n  return decorator\n\n\ndef lookup(registered_collection, reg_key):\n  \"\"\"Lookup and return decorated function or class in the collection.","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/tensorflow/models/blob/e006f5f0d534913e49c1f1dae87364039fa607e2/official/core/registry.py#L30-L66","documentation":"Error \"Collection path {} at position {} already registered as a function or class.\" thrown in tensorflow/models.","triggerScenarios":"Thrown at official/core/registry.py:48 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":"e006f5f0d534913e49c1f1dae87364039fa607e2","analyzedAt":"2026-08-24T14:09:15.576Z","schemaVersion":2},"datasetVersion":"2026-08-24T17:17:21.512Z"}