FujiwaraChoki/MoneyPrinterV2 · error · PostBridgeClientError
Media file does not exist
Error message
Media file does not exist: {file_path} What it means
Raised by PostBridgeClient.upload_media when the local media file path does not exist before attempting the upload handshake. The client fails fast rather than sending a bogus request to the API.
Solutions
- Check the render/download step actually produced the file before crossposting
- Use absolute, resolved paths (Path(...).resolve()) when passing file_path
- If the file was deleted, regenerate it or fix the stale path in config
Example fix
// before
client.upload_media("output/short.mp4")
// after
from pathlib import Path
p = Path("output/short.mp4").resolve()
if not p.is_file():
raise FileNotFoundError(f"Render output missing: {p}")
client.upload_media(str(p)) Defensive patterns
Strategy: validation
Validate before calling
from pathlib import Path
p = Path(file_path).expanduser().resolve()
if not p.is_file():
raise FileNotFoundError(f"Media file missing before upload: {p}")
client.upload_media(str(p)) Type guard
from pathlib import Path
def is_uploadable_media_file(p: str) -> bool:
try:
return Path(p).is_file() and Path(p).stat().st_size > 0
except OSError:
return False Try / catch
try:
client.upload_media(file_path)
except PostBridgeClientError as exc:
if "Media file does not exist" in str(exc):
regenerate_media_and_retry(file_path)
else:
raise Prevention
- Pass absolute resolved paths to upload_media
- Verify the render step succeeded before starting the crosspost flow
- Keep generated media in a stable directory that isn't cleaned by tmp janitors
When it happens
Trigger: Calling maybe_crosspost_youtube_short with a video path that was moved/deleted after generation, a relative path resolved from a different cwd, or a typo in the configured output path.
Common situations: Temp files cleaned up between generation and crosspost, paths from config.json pointing at another machine's layout, or the render step failing silently so the file was never produced.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Post Bridge did not return a media_id and upload_url.
- Firefox profile path does not exist or is not a directory
- Post Bridge returned a non-JSON response.
- Post Bridge returned an invalid social accounts payload.
- Request to Post Bridge failed
AI-assisted analysis of FujiwaraChoki/MoneyPrinterV2@5192af8eca (2026-08-28).
Data as JSON: /api/errors/235e06c1fc703322.
Report an issue: GitHub.
Appendix: source
Thrown at src/classes/PostBridge.py:99
accounts.extend(page_accounts)
meta = response_json.get("meta", {})
url = meta.get("next") if isinstance(meta, dict) else None
return accounts
def upload_media(self, file_path: str) -> str:
"""
Upload a local media file to Post Bridge and return its media ID.
Args:
file_path (str): Absolute path to a local media file.
Returns:
media_id (str): Uploaded media ID.
"""
if not os.path.exists(file_path):
raise PostBridgeClientError(f"Media file does not exist: {file_path}")
file_name = os.path.basename(file_path)
mime_type = self._guess_mime_type(file_path)
file_size = os.path.getsize(file_path)
upload_response = self._request_json(
"POST",
f"{self.API_BASE}/media/create-upload-url",
json={
"name": file_name,
"mime_type": mime_type,
"size_bytes": file_size,
},
)
media_id = upload_response.get("media_id")
upload_url = upload_response.get("upload_url")
View on GitHub (pinned to 5192af8eca)