How to Debug Video Generation Failures with Verbose Logging in MoneyPrinterV2

Enable the verbose flag in config.json to capture colour-coded, stage-by-stage diagnostics from every pipeline module including src/config.py, src/status.py, and src/classes/YouTube.py.

MoneyPrinterV2 automates YouTube Shorts creation through a multi-stage pipeline that chains topic generation, script creation, image synthesis, TTS, and upload. When generation fails, isolating the broken stage requires detailed telemetry. The built-in verbose logging system provides granular, colour-coded output from every module without code changes.

Enable Verbose Mode in config.json

The verbosity flag lives in config.json and is read by get_verbose() in src/config.py lines 42-50. Set it to true to activate detailed diagnostics.

{
  "verbose": true,
  "firefox_profile": "/home/user/.mozilla/firefox/xyz.default-release",
  "headless": false
}

When get_verbose() returns True, every call to the helper functions in src/status.py (info, warning, success, error) prefixes the message with an emoji and prints it in colour according to severity.

Pipeline Stages and Log Locations

Verbose output tracks every phase of the Shorts pipeline. Refer to the table below to map console messages to source locations.

Phase Source Function Typical Log Output
Folder preparation assert_folder_structure() in src/config.py lines 17-22 => Creating .mp folder …
Song selection choose_random_song() in src/utils.py lines 44-56 => Chose song: …
Image generation generate_image_nanobanana2() in src/classes/YouTube.py lines 31-38 => Wrote image from Nano Banana 2 API to …
TTS synthesis generate_script_to_speech() in src/classes/YouTube.py lines 11-13 => Wrote TTS to …
Clip composition combine() in src/classes/YouTube.py lines 77-88 and 122-130 => Resizing Image: …, => Generating subtitles …, Wrote Video to …
Upload upload_video() in src/classes/YouTube.py lines 35-46 and 55-66 => Setting title…, => Clicked next…, => Uploaded Video: …
Error handling Exception blocks surrounding the above Failed to generate image …, Failed to generate subtitles, continuing …

Step-by-Step Debug Workflow

Follow this sequence to isolate and resolve failures using verbose output.

  1. Enable verbose in config.json and ensure get_verbose() returns True.
  2. Run the generator (e.g., python -m src.main). The console streams colour-coded progress.
  3. Locate the last successful message – everything downstream is the failing stage.
  4. Inspect the warning or error line for HTTP status codes, file paths, or exception names.
  5. Cross-reference the source using the file paths in the table above to confirm which API call or binary interaction failed.
  6. Apply the fix (update API keys, install missing dependencies, correct file permissions).
  7. Rerun – verbose output confirms the fix moved the failure point downstream or eliminated it.

Common Failure Points and Verbose Clues

Symptom Verbose Clue Likely Cause Fix
nanobanana2_api_key is not configured error() from generate_image_nanobanana2() in src/classes/YouTube.py lines 31-34 Missing Gemini API key in config.json or environment Add nanobanana2_api_key or GEMINI_API_KEY to config.
Failed to fetch songs … warning() in fetch_songs() in src/utils.py lines 19-22 Bad zip_url or network failure Verify zip_url in config.json and network connectivity.
Local STT selected but 'faster-whisper' is not installed error() in generate_subtitles_local_whisper() in src/classes/YouTube.py lines 15-22 Missing Python dependency Run pip install faster-whisper.
Failed to generate subtitles, continuing without subtitles warning() from combine() in src/classes/YouTube.py lines 124-130 Whisper/AssemblyAI API error or timeout Check stt_provider and API keys in config.
Unable to locate ImageMagick binary Exception during change_settings({"IMAGEMAGICK_BINARY": …}) on import imagemagick_path incorrect in config Update imagemagick_path in config.json to point to convert binary.

Code Examples

Configuring Verbose Mode

Update config.json to enable detailed diagnostics:

{
  "verbose": true,
  "firefox_profile": "/home/user/.mozilla/firefox/xyz.default-release",
  "headless": false,
  "imagemagick_path": "/usr/bin/convert",
  "nanobanana2_api_key": "YOUR_GEMINI_KEY"
}

Running Generation with Logging

Execute the pipeline and observe the colour-coded output:

from src.classes.YouTube import YouTube
from src.classes.Tts import TTS

# Initialize TTS engine (reads config for voice settings)

tts = TTS()

# Create YouTube channel instance

yt = YouTube(
    account_uuid="1234-abcd",
    account_nickname="DebugChannel",
    fp_profile_path="/home/user/.mozilla/firefox/xyz.default-release",
    niche="tech gadgets",
    language="en"
)

# Verbose output streams automatically from status.py helpers

video_path = yt.generate_video(tts)
print(f"Output: {video_path}")

Manual Log Triggering

Inject custom diagnostic markers during debugging:

from src.status import info, warning, error
from src.config import get_verbose

# Verify verbose state

if get_verbose():
    info("Custom debug point reached")
    
try:
    # Your failing code here

    risky_operation()
except Exception as exc:
    error(f"Operation failed: {exc}")
    warning("Continuing with fallback...")

Summary

  • Enable verbose logging by setting "verbose": true in config.json; get_verbose() in src/config.py controls the toggle.
  • Trace failures through colour-coded output from src/status.py helpers (info, warning, success, error).
  • Map logs to code using the pipeline table—every stage from assert_folder_structure() to upload_video() emits specific diagnostics.
  • Fix common issues by matching verbose clues to the failure matrix: missing API keys, uninstalled faster-whisper, incorrect ImageMagick paths, or bad network URLs.
  • Debug without code changes—the config-driven logger exposes file paths, variable values, and exception traces safely (without printing secrets).

Frequently Asked Questions

How do I enable verbose logging without editing the JSON file?

You cannot toggle verbose mode at runtime without modifying config.json. The get_verbose() function in src/config.py reads the file directly and caches the value. To change verbosity, stop the application, edit config.json, and restart.

Why are my API keys not showing in the verbose logs even when enabled?

The logging helpers in src/status.py intentionally never print the contents of variables that contain "key", "token", or "password" to prevent credential leakage. If an API call fails, the log will show the endpoint and error code, but not the secret itself.

Can I redirect verbose output to a log file instead of the console?

Yes. Because src/status.py uses standard print() statements wrapped in colour codes, you can redirect stdout when running the script: python -m src.main > debug.log 2>&1. The ANSI colour codes will be preserved in the file and can be viewed with cat or less -R.

What does the [!] prefix mean in the verbose output?

The [!] prefix indicates a warning emitted by the warning() function in src/status.py. It appears when a non-fatal error occurs—such as a failed subtitle generation that allows the pipeline to continue. Fatal errors use [X] or (from error()), while successes use [+] or .

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →