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: {fp_profile_path} What it means
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.
Source
Thrown at src/classes/AFM.py:54
fp_profile_path (str): The path to the Firefox profile
twitter_account_uuid (str): The Twitter account UUID
account_nickname (str): The account nickname
topic (str): The topic of the product
Returns:
None
"""
self._fp_profile_path: str = fp_profile_path
# 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(fp_profile_path):
raise ValueError(
f"Firefox profile path does not exist or is not a directory: {fp_profile_path}"
)
# Set the profile path
self.options.add_argument("-profile")
self.options.add_argument(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
)
# Set the affiliate link
self.affiliate_link: str = affiliate_link
View on GitHub (pinned to 5192af8eca)
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
Example fix
// before
afm = AFM(fp_profile_path="~/mozilla/firefox/profile", ...)
// after
from pathlib import Path
fp = Path("~/mozilla/firefox/profile").expanduser().resolve()
if not fp.is_dir():
raise FileNotFoundError(f"Configure a valid Firefox profile at {fp}")
afm = AFM(fp_profile_path=str(fp), ...) Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
fp = Path(fp_profile_path).expanduser().resolve()
if not fp.is_dir():
raise FileNotFoundError(f"Configure a valid Firefox profile directory: {fp}")
afm = AFM(fp_profile_path=str(fp), ...) Type guard
from pathlib import Path
def is_valid_profile_dir(p: str) -> bool:
try:
return Path(p).expanduser().resolve().is_dir()
except (OSError, ValueError):
return False Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Media file does not exist: {file_path}
- Firefox profile path does not exist or is not a directory: {
- Firefox profile path does not exist or is not a directory: {
- Unsupported provider '{provider}'. Expected 'twitter' or 'yo
- Affiliate link is invalid. Expected a full URL, got: {self.a
AI-assisted analysis of FujiwaraChoki/MoneyPrinterV2@5192af8eca (2026-08-28).
Data as JSON: /api/errors/31af5c767553c8c5.
Report an issue: GitHub.