ATH-MaaS/Pixelle-Video · error · FileNotFoundError

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

Error message

Template not found: {size}/{template_name}
Available templates for size {size}: {available_templates}

What it means

get_template_full_path delegates to get_resource_path('templates', size, template_name), searching the custom directory then the default package resources. On FileNotFoundError it lists available templates for that size via list_templates_for_size and raises FileNotFoundError('Template not found: size/template_name ... Available templates: ...'). It means the requested template does not exist for the given resolution.

Source

Thrown at pixelle_video/utils/template_util.py:167

        size: Size string like "1080x1920"
        template_name: Template filename like "default.html"
    
    Returns:
        Full path like "templates/1080x1920/default.html" or "data/templates/1080x1920/default.html"
    
    Raises:
        FileNotFoundError: If template file doesn't exist in either location
    
    Examples:
        >>> get_template_full_path("1080x1920", "default.html")
        'templates/1080x1920/default.html'
    """
    # Use new resource API to search custom first, then default
    try:
        return get_resource_path("templates", size, template_name)
    except FileNotFoundError:
        available_templates = list_templates_for_size(size)
        raise FileNotFoundError(
            f"Template not found: {size}/{template_name}\n"
            f"Available templates for size {size}: {available_templates}"
        )


class TemplateDisplayInfo(BaseModel):
    """Template display information for UI layer"""
    
    name: str = Field(..., description="Template name without extension")
    size: str = Field(..., description="Size string like '1080x1920'")
    width: int = Field(..., description="Width in pixels")
    height: int = Field(..., description="Height in pixels")
    orientation: Literal['portrait', 'landscape', 'square'] = Field(
        ..., 
        description="Video orientation"
    )
    is_standard: bool = Field(
        ..., 

View on GitHub (pinned to 848b054e4f)

Solutions

  1. Check the 'Available templates' list in the error message and use one of those names.
  2. Create the missing template file in your custom templates/<size>/ directory.
  3. Fix typos in template_name or size (exact filenames, including .html extension).
  4. Verify your custom resource directory configuration points at the folder actually containing your templates.
  5. Catch FileNotFoundError and fall back to a bundled default template.

Example fix

// before
tpl = get_template_full_path("1080x1920", "cinematic.html")
// after
try:
    tpl = get_template_full_path("1080x1920", "cinematic.html")
except FileNotFoundError as e:
    logger.warning(f"{e}; falling back to default")
    tpl = get_template_full_path("1080x1920", "default.html")
Defensive patterns

Strategy: try-catch

Validate before calling

from pixelle_video.utils.template_util import list_templates_for_size

def template_available(size: str, name: str) -> bool:
    return name in list_templates_for_size(size)
# check before calling get_template_full_path

Type guard

def pick_template(size: str, preferred: str, fallback: str = "default.html") -> str:
    available = list_templates_for_size(size)
    return preferred if preferred in available else fallback

Try / catch

try:
    tpl = get_template_full_path(size, template_name)
except FileNotFoundError as e:
    logger.warning("%s — available: %s", e, e.args)
    tpl = get_template_full_path(size, "default.html")

Prevention

When it happens

Trigger: get_template_full_path(size, name) — or callers like get_resource_path consumers (_scan_workflows, resolve_template_path, etc.) — with a template_name that is absent from both custom and default 'templates/<size>/' directories.

Common situations: Typos in template names ('defualt.html'); requesting a custom template that was never created for that size; using a size directory that exists but is empty; custom resource directory misconfigured so the lookup silently misses it; templates removed in a library upgrade.

Related errors


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