calesthio/OpenMontage · error · ValueError

Unknown profile {name!r}. Available: {available}

Error message

Unknown profile {name!r}. Available: {available}

What it means

Raised by lib/media_profiles.py's get_profile() when the requested profile name is not a key in ALL_PROFILES. The registry is a fixed dict of nine built-in profiles (YOUTUBE_LANDSCAPE, YOUTUBE_4K, YOUTUBE_SHORTS, INSTAGRAM_REELS, INSTAGRAM_FEED, TIKTOK, LINKEDIN, CINEMATIC, GENERIC_HD); profile names are exact-match, case-sensitive identifiers. The error message lists all valid names, so a mismatch is usually a typo, wrong casing, or an assumption that a profile exists after a rename.

Source

Thrown at lib/media_profiles.py:146

)


# ---- Profile registry ----

ALL_PROFILES: dict[str, MediaProfile] = {
    p.name: p for p in [
        YOUTUBE_LANDSCAPE, YOUTUBE_4K, YOUTUBE_SHORTS,
        INSTAGRAM_REELS, INSTAGRAM_FEED,
        TIKTOK, LINKEDIN, CINEMATIC, GENERIC_HD,
    ]
}


def get_profile(name: str) -> MediaProfile:
    """Get a media profile by name."""
    if name not in ALL_PROFILES:
        available = ", ".join(ALL_PROFILES.keys())
        raise ValueError(f"Unknown profile {name!r}. Available: {available}")
    return ALL_PROFILES[name]


def get_profiles_for_platform(platform: str) -> list[MediaProfile]:
    """Get all profiles matching a platform prefix."""
    return [p for name, p in ALL_PROFILES.items() if name.startswith(platform)]


def ffmpeg_output_args(profile: MediaProfile) -> list[str]:
    """Generate FFmpeg output arguments for a media profile."""
    args = [
        "-c:v", profile.codec,
        "-c:a", profile.audio_codec,
        "-crf", str(profile.crf),
        "-pix_fmt", profile.pixel_format,
        "-r", str(profile.fps),
        "-vf", f"scale={profile.width}:{profile.height}",
    ]

View on GitHub (pinned to 95e1c3d0ab)

Solutions

  1. Copy the exact name from the error's Available list (names are UPPERCASE with underscores).
  2. If the name comes from config, validate it against get_profiles_for_platform or ALL_PROFILES before use.
  3. Use list/registry helpers (ALL_PROFILES keys, get_profiles_for_platform(platform)) to pick a valid name programmatically.

Example fix

# before
profile = get_profile("youtube_shorts")  # ValueError

# after
profile = get_profile("YOUTUBE_SHORTS")
# or discover valid names:
valid = list(ALL_PROFILES)  # / get_profiles_for_platform("YOUTUBE")
Defensive patterns

Strategy: type-guard

Validate before calling

from lib.media_profiles import ALL_PROFILES

if profile_name not in ALL_PROFILES:
    raise SystemExit(f"Pick one of: {', '.join(ALL_PROFILES)}")

Type guard

from lib.media_profiles import ALL_PROFILES, MediaProfile

def is_valid_profile(name: str) -> bool:
    return name in ALL_PROFILES

Try / catch

try:
    profile = get_profile(name)
except ValueError as e:
    # message already lists valid names; surface it to the user/config error path
    raise ConfigError(str(e)) from e

Prevention

When it happens

Trigger: Calling get_profile('youtube_shorts') (lowercase) instead of get_profile('YOUTUBE_SHORTS'); passing a user-supplied or config-file profile string straight through; referencing a profile name that was renamed or removed between versions.

Common situations: Typo or wrong case in a pipeline config or CLI flag; profile renamed in an upstream release; assuming platform prefixes (e.g. 'youtube') are themselves profiles.

Related errors


AI-assisted analysis of calesthio/OpenMontage@95e1c3d0ab (2026-08-15). Data as JSON: /api/errors/aa49b73d541e2717. Report an issue: GitHub.