{"record":{"id":"efce19628b501a14","repo":"reflex-dev/reflex","slug":"hybridproperty-has-no-getter-function","errorCode":null,"errorMessage":"HybridProperty has no getter function","messagePattern":"HybridProperty has no getter function","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"packages/reflex-base/src/reflex_base/vars/hybrid_property.py","lineNumber":85,"sourceCode":"        ``ObjectVar`` (for attribute access on an object var, e.g. ``State.info.a_b``).\n        Attribute access on ``owner`` inside the getter/var function resolves to Vars.\n\n        Args:\n            owner: The class or var the property is accessed on.\n\n        Returns:\n            The frontend Var for the property.\n\n        Raises:\n            AttributeError: If the property has no getter function and no var function is set.\n        \"\"\"\n        if self._var is not None:\n            # Call custom var function if set\n            return self._var(owner)\n        # Call the property getter function if no custom var function is set\n        if self.fget is None:\n            msg = \"HybridProperty has no getter function\"\n            raise AttributeError(msg)\n        return self.fget(owner)\n\n    @override\n    def __get__(self, instance: Any, owner: type | None = None, /) -> Any:\n        \"\"\"Get the value of the property.\n\n        On an instance, return the getter's value. At the class level, return a\n        frontend Var only when accessed on a state (whose class attributes are\n        vars); on any other class there is no var context, so return the\n        descriptor itself, like a normal property. Note that var access on a\n        nested object (e.g. ``State.info.a_b``) does not go through ``__get__`` —\n        it is resolved by ``ObjectVar.__getattr__`` via ``_get_var``.\n\n        Args:\n            instance: The instance of the class accessing this property.\n            owner: The class that this descriptor is attached to.\n\n        Returns:","sourceCodeStart":67,"sourceCodeEnd":103,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/packages/reflex-base/src/reflex_base/vars/hybrid_property.py#L67-L103","documentation":"When a HybridProperty is used in a frontend (var) context via _get_var, Reflex first tries a custom var function set with @<name>.var; otherwise it falls back to the property's getter (fget). If neither exists (fget is None, e.g. a property defined with only a setter), AttributeError is raised.","triggerScenarios":"Declaring a hybrid property with no getter — only a setter or deleter — and then referencing it in the frontend or calling .var on it; or manually constructing HybridProperty(fset=...) without fget.","commonSituations":"Write-only style properties converted to hybrid_property; property factories that conditionally omit the getter; refactoring where the getter was accidentally deleted but setters remained.","solutions":["Add a getter function to the hybrid property (def the body under @rx.hybrid_property).","Or supply an explicit frontend implementation with @<property_name>.var so _get_var uses it instead of fget.","If the property is intentionally write-only, don't reference it in frontend code."],"exampleFix":"# before\nclass State(rx.State):\n    @rx.hybrid_property\n    def value(self): ...\n    @value.setter\n    def value(self, v): self._v = v\n# later: rx.text(State.value)  -> AttributeError\n\n# after\nclass State(rx.State):\n    @rx.hybrid_property\n    def value(self):\n        return self._v\n    @value.setter\n    def value(self, v): self._v = v","handlingStrategy":"type-guard","validationCode":"prop = State.__dict__.get(\"value\")\nassert getattr(prop, \"fget\", None) is not None or getattr(prop, \"_var\", None) is not None","typeGuard":"def hybrid_has_getter_or_var(p) -> bool:\n    return p.fget is not None or p._var is not None","tryCatchPattern":null,"preventionTips":["Always define a getter body under @rx.hybrid_property.","Keep the getter when adding setters.","Reference hybrid properties in frontend only when a getter or .var implementation exists."],"tags":["reflex","hybrid-property","attribute-error","missing-getter"],"backgroundTag":"hybrid-property-backend-access","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}