FujiwaraChoki/MoneyPrinterV2 · error · ValueError
Firefox profile path does not exist or is not a directory: {
Error message
Firefox profile path does not exist or is not a directory: {self._fp_profile_path} What it means
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.
Source
Thrown at src/classes/YouTube.py:87
None
"""
self._account_uuid: str = account_uuid
self._account_nickname: str = account_nickname
self._fp_profile_path: str = fp_profile_path
self._niche: str = niche
self._language: str = language
self.images = []
# Initialize the Firefox profile
self.options: Options = Options()
# Set headless state of browser
if get_headless():
self.options.add_argument("--headless")
if not os.path.isdir(self._fp_profile_path):
raise ValueError(
f"Firefox profile path does not exist or is not a directory: {self._fp_profile_path}"
)
self.options.add_argument("-profile")
self.options.add_argument(self._fp_profile_path)
# Set the service
self.service: Service = Service(GeckoDriverManager().install())
# Initialize the browser
self.browser: webdriver.Firefox = webdriver.Firefox(
service=self.service, options=self.options
)
@property
def niche(self) -> str:
"""
Getter Method for the niche.View on GitHub (pinned to 5192af8eca)
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
Example fix
# before
"fp_profile_path": "~/FirefoxProfiles/yt"
# after (config stores absolute path, code expands it)
import os
path = os.path.abspath(os.path.expanduser(cfg["fp_profile_path"]))
if not os.path.isdir(path):
raise SystemExit(f"configure profile at {path}") Defensive patterns
Strategy: validation
Validate before calling
import os
path = os.path.abspath(os.path.expanduser(cfg["fp_profile_path"]))
if not os.path.isdir(path):
raise SystemExit(f"Configure YouTube Firefox profile at {path}") Type guard
def is_valid_profile_path(p: str) -> bool:
import os
return isinstance(p, str) and os.path.isdir(os.path.expanduser(p)) Try / catch
try:
yt = YouTube(...)
except ValueError as e:
print(f"Bad profile config: {e}"); raise Prevention
- Use absolute expanded paths
- Add profile check to scripts/preflight_local.py
- Document the expected profile location in setup docs
When it happens
Trigger: 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 ~.
Common situations: Unexpanded tilde path, OS-specific separators, profile directory deleted, or running from a different working directory with a relative path.
Related errors
- Firefox profile path does not exist or is not a directory: {
- Firefox profile path does not exist or is not a directory: {
- Could not find tweet text box. Ensure you are logged into X
- Could not find the Post button on X compose screen.
AI-assisted analysis of FujiwaraChoki/MoneyPrinterV2@5192af8eca (2026-08-28).
Data as JSON: /api/errors/b09dd9411cefdeb9.
Report an issue: GitHub.