{"record":{"id":"f7a1b875ddc13a70","repo":"reflex-dev/reflex","slug":"could-not-find-module-config-module","errorCode":null,"errorMessage":"Could not find module {config.module}.","messagePattern":"Could not find module (.+?)\\.","errorType":"exception","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"reflex/utils/rename.py","lineNumber":81,"sourceCode":"    Raises:\n        SystemExit: If the command is not ran in the root dir or the app module cannot be imported.\n    \"\"\"\n    # Set the log level.\n    console.set_log_level(loglevel)\n\n    if not constants.Config.FILE.exists():\n        logger.error(\n            \"No rxconfig.py found. Make sure you are in the root directory of your app.\"\n        )\n        raise SystemExit(1)\n\n    sys.path.insert(0, str(Path.cwd()))\n\n    config = get_config()\n    module_path = get_module_path(config.module)\n    if module_path is None:\n        logger.error(f\"Could not find module {config.module}.\")\n        raise SystemExit(1)\n\n    logger.info(f\"Renaming app directory to {new_app_name}.\")\n    process_directory(\n        Path.cwd(),\n        config.app_name,\n        new_app_name,\n        exclude_dirs=[constants.Dirs.WEB, constants.Dirs.APP_ASSETS],\n    )\n\n    rename_path_up_tree(module_path, config.app_name, new_app_name)\n\n    logger.log(\n        log.SUCCESS,\n        f\"App directory renamed to [bold]{escape(new_app_name)}[/bold].\",\n        extra={\"rich\": True},\n    )\n\n","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/reflex-dev/reflex/blob/45b8ed5ab735f8a56bbb09a42384f030eb0208e7/reflex/utils/rename.py#L63-L99","documentation":"Raised by `reflex.utils.rename.rename_app` when the module path computed from `config.module` cannot be located on disk. Before renaming an app, Reflex resolves the module in rxconfig.py to a filesystem path; if `get_module_path` returns None the app directory cannot be found and the rename aborts via SystemExit(1). It almost always means rxconfig.py declares a module name that doesn't match the actual directory/file layout.","triggerScenarios":"Running `reflex rename <new_name>` (or calling rename/rename_app) when config.module (e.g. \"my_app\") does not correspond to an existing my_app/ directory or my_app.py file in the current working directory.","commonSituations":"rxconfig.py was hand-edited so app_name/module no longer match the directory; the command is run from the wrong directory (not the project root); the app directory was already moved/renamed manually; sys.path doesn't include cwd so module discovery fails.","solutions":["Verify you are in the project root and that the directory (or my_app.py) named by config.module in rxconfig.py actually exists; fix the module name in rxconfig.py if it drifted.","If the directory was already renamed manually, update rxconfig.py to the current name instead of running `reflex rename` again.","Re-run `reflex rename <new_name>` once module and directory agree."],"exampleFix":"# before (rxconfig.py)\nconfig = rx.Config(app_name=\"old_name\")  # but directory is my_app/\n\n# after\nconfig = rx.Config(app_name=\"my_app\")  # matches ./my_app","handlingStrategy":"validation","validationCode":"from pathlib import Path\nimport reflex.utils.format as fmt\n\ndef can_rename() -> bool:\n    from reflex.config import get_config\n    module = get_config().module\n    return (Path.cwd() / module).is_dir() or (Path.cwd() / f\"{module}.py\").is_file()","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep rxconfig.py's app_name in sync with the actual app directory.","Run reflex CLI commands from the project root.","Avoid renaming the app directory manually; use `reflex rename`."],"tags":["reflex","module-not-found","config","rename","cli"],"backgroundTag":"module-not-found","analyzedSha":"45b8ed5ab735f8a56bbb09a42384f030eb0208e7","analyzedAt":"2026-08-28T19:25:27.644Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}