{"record":{"id":"2e58f3cc362be45c","repo":"ATH-MaaS/Pixelle-Video","slug":"invalid-size-dimensions-width-x-height","errorCode":null,"errorMessage":"Invalid size dimensions: {width}x{height}","messagePattern":"Invalid size dimensions: (.+?)x(.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"pixelle_video/utils/template_util.py","lineNumber":80,"sourceCode":"            f\"Invalid template path format: {template_path}. \"\n            f\"Expected format: 'WIDTHxHEIGHT/template.html' or 'templates/WIDTHxHEIGHT/template.html'\"\n        )\n    \n    # Parse size from directory name\n    if 'x' not in dir_name:\n        raise ValueError(\n            f\"Invalid size format in path: {template_path}. \"\n            f\"Directory name should be 'WIDTHxHEIGHT' (e.g., '1080x1920')\"\n        )\n    \n    try:\n        width_str, height_str = dir_name.split('x')\n        width = int(width_str)\n        height = int(height_str)\n        \n        # Sanity check\n        if width < 100 or height < 100 or width > 10000 or height > 10000:\n            raise ValueError(f\"Invalid size dimensions: {width}x{height}\")\n        \n        return (width, height)\n    except ValueError as e:\n        raise ValueError(\n            f\"Failed to parse size from path: {template_path}. \"\n            f\"Expected format: 'WIDTHxHEIGHT/template.html' (e.g., '1080x1920/default.html'). \"\n            f\"Error: {e}\"\n        )\n\n\ndef list_available_sizes() -> List[str]:\n    \"\"\"\n    List all available video sizes (merged from templates/ and data/templates/)\n    \n    Returns:\n        List of size strings like [\"1080x1920\", \"1920x1080\", \"1080x1080\"]\n    \n    Examples:","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/ATH-MaaS/Pixelle-Video/blob/848b054e4fae40dabc62ec58e960b573e83793ac/pixelle_video/utils/template_util.py#L62-L98","documentation":"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'.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Rename the directory to realistic canvas dimensions between 100 and 10000 px, e.g. '1080x1920'.","Check for typos or extra zeros in the directory name.","If you genuinely need >10000 px output, adjust the sanity-check bounds in template_util.py.","Validate configured resolutions at startup before rendering."],"exampleFix":"// before\ntemplates/80x80/default.html\n// after\ntemplates/1080x1080/default.html  # dimensions must be within 100-10000","handlingStrategy":"validation","validationCode":"def size_in_bounds(w: int, h: int) -> bool:\n    return 100 <= w <= 10000 and 100 <= h <= 10000\n# assert size_in_bounds(*parse_template_size(tpl_path)) before rendering","typeGuard":"def safe_parse_size(template_path: str):\n    try:\n        w, h = parse_template_size(template_path)\n    except ValueError:\n        return None\n    return (w, h) if 100 <= w <= 10000 and 100 <= h <= 10000 else None","tryCatchPattern":"try:\n    w, h = parse_template_size(template_path)\nexcept ValueError as e:\n    if \"Invalid size dimensions\" in str(e):\n        logger.error(\"Directory name out of 100-10000 px bounds: %s\", e)\n    raise","preventionTips":["Only create template directories with realistic canvas sizes (100-10000 px)","Watch for typos like extra zeros in dimension folder names","Validate configured resolutions against bounds before rendering","Keep placeholder/test directories out of the templates tree"],"tags":["validation","dimensions","templates"],"backgroundTag":"invalid-size-dimensions","analyzedSha":"848b054e4fae40dabc62ec58e960b573e83793ac","analyzedAt":"2026-08-30T03:24:41.468Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}