{"record":{"id":"31af5c767553c8c5","repo":"FujiwaraChoki/MoneyPrinterV2","slug":"firefox-profile-path-does-not-exist-or-is-not-a-di","errorCode":null,"errorMessage":"Firefox profile path does not exist or is not a directory: {fp_profile_path}","messagePattern":"Firefox profile path does not exist or is not a directory: (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/classes/AFM.py","lineNumber":54,"sourceCode":"            fp_profile_path (str): The path to the Firefox profile\n            twitter_account_uuid (str): The Twitter account UUID\n            account_nickname (str): The account nickname\n            topic (str): The topic of the product\n\n        Returns:\n            None\n        \"\"\"\n        self._fp_profile_path: str = fp_profile_path\n\n        # Initialize the Firefox profile\n        self.options: Options = Options()\n\n        # Set headless state of browser\n        if get_headless():\n            self.options.add_argument(\"--headless\")\n\n        if not os.path.isdir(fp_profile_path):\n            raise ValueError(\n                f\"Firefox profile path does not exist or is not a directory: {fp_profile_path}\"\n            )\n\n        # Set the profile path\n        self.options.add_argument(\"-profile\")\n        self.options.add_argument(fp_profile_path)\n\n        # Set the service\n        self.service: Service = Service(GeckoDriverManager().install())\n\n        # Initialize the browser\n        self.browser: webdriver.Firefox = webdriver.Firefox(\n            service=self.service, options=self.options\n        )\n\n        # Set the affiliate link\n        self.affiliate_link: str = affiliate_link\n","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/FujiwaraChoki/MoneyPrinterV2/blob/5192af8eca97759f941834b947e3ceb209da0649/src/classes/AFM.py#L36-L72","documentation":"Raised in AFM.__init__ when the Firefox profile path passed to the browser launcher is not an existing directory. Selenium-Firefox cannot start with a nonexistent profile, so the constructor fails fast before instantiating the driver.","triggerScenarios":"Creating an AFM instance with fp_profile_path pointing to a deleted/moved Firefox profile, a file instead of a directory, a relative path resolved from the wrong cwd, or a path with a typo.","commonSituations":"Profile directory moved or cleaned up between runs, hardcoded absolute paths in config.json that don't exist on another machine, or running from a different working directory so a relative profile path doesn't resolve.","solutions":["Verify the path exists: ls <fp_profile_path> and confirm it is a directory","Correct the profile path in config.json or the environment variable supplying it","Use an absolute path (os.path.abspath / Path(...).resolve()) to avoid cwd-dependent resolution","If the profile was deleted, recreate it or point to an existing Firefox profile"],"exampleFix":"// before\nafm = AFM(fp_profile_path=\"~/mozilla/firefox/profile\", ...)\n\n// after\nfrom pathlib import Path\nfp = Path(\"~/mozilla/firefox/profile\").expanduser().resolve()\nif not fp.is_dir():\n    raise FileNotFoundError(f\"Configure a valid Firefox profile at {fp}\")\nafm = AFM(fp_profile_path=str(fp), ...)","handlingStrategy":"validation","validationCode":"from pathlib import Path\nfp = Path(fp_profile_path).expanduser().resolve()\nif not fp.is_dir():\n    raise FileNotFoundError(f\"Configure a valid Firefox profile directory: {fp}\")\nafm = AFM(fp_profile_path=str(fp), ...)","typeGuard":"from pathlib import Path\n\ndef is_valid_profile_dir(p: str) -> bool:\n    try:\n        return Path(p).expanduser().resolve().is_dir()\n    except (OSError, ValueError):\n        return False","tryCatchPattern":null,"preventionTips":["Always expanduser() and resolve() profile paths before passing them in","Add a preflight check (like scripts/preflight_local.py) that validates configured paths on startup","Never rely on relative profile paths; store absolute paths in config.json"],"tags":["python","selenium","firefox","filesystem","config"],"backgroundTag":"path-not-found","analyzedSha":"5192af8eca97759f941834b947e3ceb209da0649","analyzedAt":"2026-08-28T10:31:46.474Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}