Skip to content

Reflex Frontend Exception when re-compiling after code changes #5545

Closed as not planned

Description

@thorsmann

Describe the bug
Follow up to this one: #5519

Reflex frontend errors are printed to command line when code is re-compiled after code changes. Killing and restaring process fixes the issue. Just happens during development when code changes are applied directly.

[Reflex Frontend Exception]
 Error:  No module update found for route routes/_index
    at http://localhost:3000/@id/__x00__virtual:react-router/hmr-runtime:476:15


To Reproduce

import reflex as rx


class State(rx.State):
    count: int = 0

    @rx.var
    def count_plus_one(self) -> int:
        """Return the count plus one."""
        return self.count + 1
    
    @rx.event
    def increment(self) -> int:
        self.count += 1    


def index():
    return rx.vstack(
        rx.text("Hey"),
        rx.text(f"Hello there! - {State.count}", font_size=".75em"),
        rx.button("Test", on_click=State.increment)
    )


def dynamic():
    return rx.vstack(
        "dynamic contet",
        # launch app - than activate/deactivate below code to trigger react error
        # rx.cond(
        #     State.count_plus_one,
        #     rx.text(":)")
        # ),
    )


app = rx.App()
app.add_page(index)
app.add_page(dynamic, route="/dynamic")

You may have to comment in/out the code block in the dynamic() function a few times to trigger the exception. I was not able to find a fully deterministic way to provoke the issue.

Specifics (please complete the following information):

  • Python Version: 3.12
  • Reflex Version: 0.8.1
  • OS: OSX
  • Browser (Optional): Chrome

Additional context
Not every change triggers the problem. Some do but it is hard to narrow down deterministically. Issue was introduced in 0.8.x release. Did not occur in 0.7.14

Activity

  1. adhami3310 commented on Jul 10, 2025

    @adhami3310
    Member

    i'm not hitting this right now :/

  2. added
    cannot repro
    on Jul 10, 2025
  3. thorsmann commented on Jul 11, 2025

    @thorsmann
    Author

    Okay, another try. slightly modified code

    import reflex as rx
    
    class State(rx.State):
        count: int = 0
    
        @rx.var
        def count_plus_one(self) -> int:
            """Return the count plus one."""
            return self.count + 1
    
        @rx.event
        def increment(self) -> int:
            self.count += 1
    
    
    def index():
        return rx.vstack(
            rx.text(f"Counter at {State.count}"),
            rx.button("Increment", on_click=State.increment),
            rx.button("Redirect", on_click=lambda: rx.redirect("/dynamic")),
        )
    
    def render_more() -> rx.Component:
        return rx.hstack(rx.text("render_more()...", font_size="0.75em"))
    
    def dynamic():
        return rx.vstack(
            rx.cond(State.count == 0, rx.text("Counter is at zero")),
            rx.text("hi"),
            rx.button("back to /", on_click=lambda: rx.redirect("/")),
            render_more()
        )
    
    
    app = rx.App()
    app.add_page(index, route="/")
    app.add_page(dynamic, route="/dynamic")
    

    my pyproject.toml

    [project]
    name = "mwe"
    version = "0.1.0"
    description = "Add your description here"
    readme = "README.md"
    requires-python = ">=3.12"
    dependencies = [
        "reflex>=0.8.1",
    ]
    
    
    1. Start the application, I do uv run reflex run
    2. Click on the redirect button
    3. Modify this line of code
    def render_more() -> rx.Component:
        return rx.hstack(rx.text("render_more()...", font_size="0.75em"))
    

    Modify the font_size parameter to 1.75em and save / trigger re-compile.

    For me, this change triggers the issue most of the time. Latest after changing it back to 0.75em and saving to trigger a re-compile I get the exception on the console.

    I am on OSX using zsh to start the application/reflex. Is this now reproducable for you?

  4. adhami3310 commented on Jul 11, 2025

    @adhami3310
    Member

    i'm still not reproducing it, do you have node globally? and what version is it node --version?

  5. thorsmann commented on Jul 14, 2025

    @thorsmann
    Author

    My global node version was v23.11.0. I just updated to the latest 24.4.0. This seems to fix it. Thank you!

  6. kesevone commented on Jul 20, 2025

    @kesevone

    +1

    C:\Users\user>node --version
    v24.4.1
    

    reflex==0.8.0

    Tried to get rid of the error, but honestly I’m kinda stuck. At first I thought it was because I was passing Optional values from my Pydantic model into params that aren’t marked as optional — made sense at first, since the error looked like it was about that. But nope, it still pops up even when that’s not the case.

    Then I tried adding a dummy page for the / route that just returns rx.text(), gave it a different name (not index), just in case... but yeah, didn’t help either. Which makes sense, 'cause why would the function name matter? Still, the error kept showing up and disappearing randomly.

    I’ll keep digging, but it’s kinda hard to track down since it comes and goes randomly. Feels super weird honestly.

  7. adhami3310 commented on Jul 20, 2025

    @adhami3310
    Member

    we had some fixes we know about that came in 0.8.1 btw, so 0.8.0 might have some predictable ones of this kind

  8. kesevone commented on Jul 20, 2025

    @kesevone

    we had some fixes we know about that came in 0.8.1 btw, so 0.8.0 might have some predictable ones of this kind

    Oh, thanks for the info — just updated, I’ll keep an eye on it.

  9. thorsmann commented on Aug 6, 2025

    @thorsmann
    Author

    The update of node reduced the occurrence quite drastically but I still get this issue. I cannot really make much sense why some changes still cause this error and some don't.

  10. adhami3310 commented on Aug 6, 2025

    @adhami3310
    Member

    generally, if a reflex compile updates multiple files, including ones where the developer is not viewing, that typically happens, but it's more frustrating when reflex compiles a file in-deterministically causing random saves to change things that weren't intended

    if anyone has small enough of a repro, feel free to paste it here, i will try investigating any we can reproduce

  11. masenf commented on Mar 25, 2026

    @masenf
    Collaborator

    Closing due to inactivity — we were unable to reproduce this deterministically and there's been no update since August 2025. Hot-reload has seen several improvements since 0.8.1. If you're still hitting this on a recent version of Reflex, please reopen with steps to reproduce.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    cannot repro

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions