ATH-MaaS/Pixelle-Video · error · ValueError

Invalid size dimensions: {width}x{height}

Error message

Invalid size dimensions: {width}x{height}

What it means

After parsing WIDTHxHEIGHT from the directory name, parse_template_size sanity-checks that both dimensions are within 100–10000 pixels; outside that range it raises ValueError('Invalid size dimensions: WxH'). This catches nonsense sizes like '0x0', '50x50', or '99999x99999'.

Source

Thrown at pixelle_video/utils/template_util.py:80

            f"Invalid template path format: {template_path}. "
            f"Expected format: 'WIDTHxHEIGHT/template.html' or 'templates/WIDTHxHEIGHT/template.html'"
        )
    
    # Parse size from directory name
    if 'x' not in dir_name:
        raise ValueError(
            f"Invalid size format in path: {template_path}. "
            f"Directory name should be 'WIDTHxHEIGHT' (e.g., '1080x1920')"
        )
    
    try:
        width_str, height_str = dir_name.split('x')
        width = int(width_str)
        height = int(height_str)
        
        # Sanity check
        if width < 100 or height < 100 or width > 10000 or height > 10000:
            raise ValueError(f"Invalid size dimensions: {width}x{height}")
        
        return (width, height)
    except ValueError as e:
        raise ValueError(
            f"Failed to parse size from path: {template_path}. "
            f"Expected format: 'WIDTHxHEIGHT/template.html' (e.g., '1080x1920/default.html'). "
            f"Error: {e}"
        )


def list_available_sizes() -> List[str]:
    """
    List all available video sizes (merged from templates/ and data/templates/)
    
    Returns:
        List of size strings like ["1080x1920", "1920x1080", "1080x1080"]
    
    Examples:

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Rename the directory to realistic canvas dimensions between 100 and 10000 px, e.g. '1080x1920'.
  2. Check for typos or extra zeros in the directory name.
  3. If you genuinely need >10000 px output, adjust the sanity-check bounds in template_util.py.
  4. Validate configured resolutions at startup before rendering.

Example fix

// before
templates/80x80/default.html
// after
templates/1080x1080/default.html  # dimensions must be within 100-10000
Defensive patterns

Strategy: validation

Validate before calling

def size_in_bounds(w: int, h: int) -> bool:
    return 100 <= w <= 10000 and 100 <= h <= 10000
# assert size_in_bounds(*parse_template_size(tpl_path)) before rendering

Type guard

def safe_parse_size(template_path: str):
    try:
        w, h = parse_template_size(template_path)
    except ValueError:
        return None
    return (w, h) if 100 <= w <= 10000 and 100 <= h <= 10000 else None

Try / catch

try:
    w, h = parse_template_size(template_path)
except ValueError as e:
    if "Invalid size dimensions" in str(e):
        logger.error("Directory name out of 100-10000 px bounds: %s", e)
    raise

Prevention

When it happens

Trigger: Template directory names like '50x50/default.html', '0x1920/default.html', or '20000x20000/default.html' passed to parse_template_size (directly or via render_frame, __init__, render_single_output, render_style_config).

Common situations: Placeholder/test directories ('1x1', 'test'); icon-size folders reused for templates; typos with extra digits ('10800x1920'); accidentally nesting templates under a directory named like a number pair that fails bounds.

Related errors


AI-assisted analysis of ATH-MaaS/Pixelle-Video@848b054e4f (2026-08-30). Data as JSON: /api/errors/2e58f3cc362be45c. Report an issue: GitHub.