ATH-MaaS/Pixelle-Video · error · FileNotFoundError

Template not found: {size}/{template_name} Available sizes:

Error message

Template not found: {size}/{template_name}
Available sizes: {available_sizes}
Hint: Use format 'SIZExSIZE/template.html' (e.g., '1080x1920/image_default.html')

What it means

resolve_template_path in pixelle_video/utils/template_util.py wraps the resource API's FileNotFoundError with a friendlier message listing valid template sizes. It is thrown when get_resource_path('templates', size, template_name) cannot find the requested HTML template under either custom or default template directories.

Source

Thrown at pixelle_video/utils/template_util.py:382

    
    # Backward compatibility: migrate "default.html" to "image_default.html"
    if template_name == "default.html":
        migrated_name = "image_default.html"
        try:
            # Try migrated name first
            path = get_resource_path("templates", size, migrated_name)
            logger.info(f"Backward compatibility: migrated '{template_input}' to '{size}/{migrated_name}'")
            return path
        except FileNotFoundError:
            # Fall through to try original name
            logger.warning(f"Migrated template '{size}/{migrated_name}' not found, trying original name")
    
    # Use resource API to resolve path (custom > default)
    try:
        return get_resource_path("templates", size, template_name)
    except FileNotFoundError:
        available_sizes = list_available_sizes()
        raise FileNotFoundError(
            f"Template not found: {size}/{template_name}\n"
            f"Available sizes: {available_sizes}\n"
            f"Hint: Use format 'SIZExSIZE/template.html' (e.g., '1080x1920/image_default.html')"
        )


def get_template_type(template_name: str) -> Literal['static', 'image', 'video']:
    """
    Detect template type from template filename
    
    Template naming convention:
    - static_*.html: Static style templates (no AI-generated media)
    - image_*.html: Templates requiring AI-generated images
    - video_*.html: Templates requiring AI-generated videos
    
    Args:
        template_name: Template filename like "image_default.html" or "video_simple.html"
    

View on GitHub (pinned to 848b054e4f)

Solutions

  1. List available sizes from the error message (list_available_sizes()) and pick an existing size directory
  2. Create the template at templates/<SIZExSIZE>/<template_name> under the custom resource directory, or copy and adapt a default template
  3. Fix the template name spelling and use lowercase 'x' in the size part (format 'SIZExSIZE/template.html')
  4. Pass only the relative 'size/name.html' form, not an absolute path

Example fix

// before
path = resolve_template_path("1920x1080", "default.html")
// after
path = resolve_template_path("1080x1920", "image_default.html")  # size+name verified against available_sizes
Defensive patterns

Strategy: validation

Validate before calling

from pixelle_video.utils.template_util import list_available_sizes
from pathlib import Path

def ensure_template(size: str, name: str):
    if size not in list_available_sizes():
        raise ValueError(f"Unknown template size '{size}'. Available: {list_available_sizes()}")
    if not name.endswith('.html'):
        raise ValueError("template_name must be an .html file, e.g. 'image_default.html'")

Try / catch

try:
    path = resolve_template_path(size, name)
except FileNotFoundError as e:
    logger.error(e)  # message already lists available sizes
    path = resolve_template_path("1080x1920", "image_default.html")  # fallback default

Prevention

When it happens

Trigger: Calling resolve_template_path('1080x1920', 'image_default.html') (directly or via render_frame / get_template_params / _validate_template) when the size directory doesn't exist, the template filename is misspelled, or the template lives outside the searched custom/default resource roots.

Common situations: Using a non-standard size like '1080X1920' (uppercase X) or '1920x1080' when only 1080x1920 templates ship; referencing a template file that was never created in the user templates folder; passing a full path instead of the 'SIZExSIZE/name.html' relative form.

Related errors


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