{"record":{"id":"35fc16e2fd3f1330","repo":"reflex-dev/reflex","slug":"memo-name-collision-for-key-0-existing-fn","errorCode":null,"errorMessage":"Memo name collision for `{key[0]}`: `{existing.fn.__module__}.{existing.python_name}` and `{definition.fn.__module__}.{definition.python_name}` both compile to the same memo name in the same module.","messagePattern":"Memo name collision for `(.+?)`: `(.+?)\\.(.+?)` and `(.+?)\\.(.+?)` both compile to the same memo name in the same module\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/reflex-base/src/reflex_base/components/memo.py","lineNumber":559,"sourceCode":"    \"\"\"Register a memo definition.\n\n    Args:\n        definition: The memo definition to register.\n\n    Raises:\n        ValueError: If another memo already compiles to the same exported name.\n    \"\"\"\n    key = _memo_registry_key(definition)\n    if (existing := MEMOS.get(key)) is not None and (\n        not _is_memo_reregistration(existing, definition)\n    ):\n        msg = (\n            f\"Memo name collision for `{key[0]}`: \"\n            f\"`{existing.fn.__module__}.{existing.python_name}` and \"\n            f\"`{definition.fn.__module__}.{definition.python_name}` both compile \"\n            \"to the same memo name in the same module.\"\n        )\n        raise ValueError(msg)\n\n    MEMOS[key] = definition\n\n\ndef _annotation_inner_type(annotation: Any) -> Any:\n    \"\"\"Unwrap a Var-like annotation to its inner type.\n\n    Args:\n        annotation: The annotation to unwrap.\n\n    Returns:\n        The inner type for the annotation.\n    \"\"\"\n    if _is_rest_annotation(annotation):\n        return dict[str, Any]\n\n    annotation = _strip_annotated(annotation)\n    origin = get_origin(annotation) or annotation","sourceCodeStart":541,"sourceCodeEnd":577,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/components/memo.py#L541-L577","documentation":"Beyond arity, @rx.dynamic requires the single parameter to carry a type hint resolving to the page's state class. Missing or extra type hints raise DynamicComponentInvalidSignatureError.","triggerScenarios":"`def page(state): ...` (no annotation) under @rx.dynamic; or annotations resolving to zero/multiple entries after signature inspection.","commonSituations":"Omitting annotations for brevity; hinting with a non-state type; IDE auto-stripping type hints in optimized builds.","solutions":["Annotate the parameter with the state class: `def page(state: PostState) -> rx.Component`","Ensure PostState subclasses rx.State and is imported at decoration time"],"exampleFix":"// before\n@rx.dynamic(route=\"/post/[pid]\")\ndef post(state): ...\n// after\n@rx.dynamic(route=\"/post/[pid]\")\ndef post(state: PostState) -> rx.Component: ...","handlingStrategy":"validation","validationCode":"import inspect\nsig = inspect.signature(fn)\n(p,) = sig.parameters.values()\nassert p.annotation is not inspect.Parameter.empty, \"annotate the state param\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Annotate the state parameter with the exact State subclass","Don't strip type hints in builds that use @rx.dynamic"],"tags":["reflex","dynamic-routes","type-hints"],"backgroundTag":"missing-type-annotation","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}