{"record":{"id":"c61fcb22193458d2","repo":"OpenBB-finance/OpenBB","slug":"error-the-app-file-app-path-does-not-exist-c61fcb","errorCode":null,"errorMessage":"Error: The app file '{app_path}' does not exist","messagePattern":"Error: The app file '(.+?)' does not exist","errorType":"exception","errorClass":"FileNotFoundError","httpStatus":null,"severity":"error","filePath":"openbb_platform/extensions/platform_api/openbb_platform_api/utils/api.py","lineNumber":272,"sourceCode":"                file_path = str(cwd.joinpath(module_path).resolve())\n            else:\n                file_path = module_path\n\n            if not Path(file_path).exists():\n                raise FileNotFoundError(  # pylint: disable=raise-missing-from\n                    f\"Error: Neither module '{module_path}' could be imported nor file '{file_path}' exists\"\n                )\n\n            module = _load_module_from_file_path(file_path)\n\n    # Case 2: File path (e.g., \"main.py\" or \"my_app/main.py\")\n    else:\n        if not Path(app_path).is_absolute():\n            cwd = Path.cwd()\n            app_path = str(cwd.joinpath(app_path).resolve())\n\n        if not Path(app_path).exists():\n            raise FileNotFoundError(f\"Error: The app file '{app_path}' does not exist\")\n\n        module = _load_module_from_file_path(app_path)\n\n    if not hasattr(module, name):\n        raise AttributeError(\n            f\"Error: The app file '{app_path}' does not contain an '{name}' instance\"\n        )\n\n    app_or_factory = getattr(module, name)\n\n    # Here we use the same approach as uvicorn to handle factory functions.\n    # This prevents us from relying on explicit type annotations.\n    # See: https://github.com/encode/uvicorn/blob/master/uvicorn/config.py\n    try:\n        app = app_or_factory()\n        if not factory:\n            print(  # noqa: T201\n                \"\\n\\n[WARNING]   \"","sourceCodeStart":254,"sourceCodeEnd":290,"githubUrl":"https://github.com/OpenBB-finance/OpenBB/blob/3e071fcc2cd9f891cac6040ae60296dba76dab46/openbb_platform/extensions/platform_api/openbb_platform_api/utils/api.py#L254-L290","documentation":"Raised when the app path is treated as a plain file path (no colon notation) and, after resolving relative paths against the current working directory, the file does not exist on disk.","triggerScenarios":"Calling import_app('main.py', 'app') (or 'my_app/main.py') when no such file exists relative to CWD or as an absolute path.","commonSituations":"Starting the OpenBB API from the wrong directory; typos in the filename; the file was renamed or deleted; shell relative-path assumptions differing from Path.cwd().","solutions":["Run the command from the directory containing the app file.","Pass an absolute path to --app.","Double-check spelling/case of the filename (case-sensitive on Linux).","If the app lives in a package, switch to module notation 'pkg.module:app' after installing the package."],"exampleFix":"# before\nimport_app('main.py', 'app')  # cwd has no main.py\n\n# after\nimport_app(str(Path(__file__).parent / 'main.py'), 'app')","handlingStrategy":"validation","validationCode":"from pathlib import Path\np = Path(app_path)\nif not p.is_absolute():\n    p = Path.cwd() / p\nassert p.is_file(), f\"app file not found: {p.resolve()}\"","typeGuard":"def app_file_exists(app_path: str) -> bool:\n    p = Path(app_path)\n    return (p if p.is_absolute() else Path.cwd() / p).is_file()","tryCatchPattern":"try:\n    app = import_app(app_path, name)\nexcept FileNotFoundError:\n    raise SystemExit(f\"app file missing: {app_path}; run from project root or pass absolute path\")","preventionTips":["Pin the working directory in launch scripts (os.chdir or absolute paths)","Fail fast on startup with a clear message","Case-sensitive filename check on Linux"],"tags":["path","fastapi","startup","file-not-found"],"backgroundTag":null,"analyzedSha":"3e071fcc2cd9f891cac6040ae60296dba76dab46","analyzedAt":"2026-08-14T23:40:48.960Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}