{"record":{"id":"b09dd9411cefdeb9","repo":"FujiwaraChoki/MoneyPrinterV2","slug":"firefox-profile-path-does-not-exist-or-is-not-a-di-b09dd9","errorCode":null,"errorMessage":"Firefox profile path does not exist or is not a directory: {self._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/YouTube.py","lineNumber":87,"sourceCode":"            None\n        \"\"\"\n        self._account_uuid: str = account_uuid\n        self._account_nickname: str = account_nickname\n        self._fp_profile_path: str = fp_profile_path\n        self._niche: str = niche\n        self._language: str = language\n\n        self.images = []\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(self._fp_profile_path):\n            raise ValueError(\n                f\"Firefox profile path does not exist or is not a directory: {self._fp_profile_path}\"\n            )\n\n        self.options.add_argument(\"-profile\")\n        self.options.add_argument(self._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    @property\n    def niche(self) -> str:\n        \"\"\"\n        Getter Method for the niche.","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/FujiwaraChoki/MoneyPrinterV2/blob/5192af8eca97759f941834b947e3ceb209da0649/src/classes/YouTube.py#L69-L105","documentation":"ValueError raised in YouTube.__init__ when self._fp_profile_path fails os.path.isdir before `-profile` is appended to Firefox options. Identical guard to the Twitter class: the selenium Firefox profile must be an existing directory or the browser cannot start.","triggerScenarios":"Constructing the YouTube automation class with a missing/file/incorrect _fp_profile_path, e.g. bad value in config.json or a path not expanded from ~.","commonSituations":"Unexpanded tilde path, OS-specific separators, profile directory deleted, or running from a different working directory with a relative path.","solutions":["Confirm directory exists: `ls <self._fp_profile_path>`","Use an absolute, expanduser-normalized path in the config","Recreate the Firefox profile if deleted","Add a preflight check (scripts/preflight_local.py) validating the path"],"exampleFix":"# before\n\"fp_profile_path\": \"~/FirefoxProfiles/yt\"\n# after (config stores absolute path, code expands it)\nimport os\npath = os.path.abspath(os.path.expanduser(cfg[\"fp_profile_path\"]))\nif not os.path.isdir(path):\n    raise SystemExit(f\"configure profile at {path}\")","handlingStrategy":"validation","validationCode":"import os\npath = os.path.abspath(os.path.expanduser(cfg[\"fp_profile_path\"]))\nif not os.path.isdir(path):\n    raise SystemExit(f\"Configure YouTube Firefox profile at {path}\")","typeGuard":"def is_valid_profile_path(p: str) -> bool:\n    import os\n    return isinstance(p, str) and os.path.isdir(os.path.expanduser(p))","tryCatchPattern":"try:\n    yt = YouTube(...)\nexcept ValueError as e:\n    print(f\"Bad profile config: {e}\"); raise","preventionTips":["Use absolute expanded paths","Add profile check to scripts/preflight_local.py","Document the expected profile location in setup docs"],"tags":["selenium","firefox","youtube","config-validation"],"backgroundTag":"invalid-config-path","analyzedSha":"5192af8eca97759f941834b947e3ceb209da0649","analyzedAt":"2026-08-28T10:31:46.474Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}