langflow-ai/langflow · error · HTTPException
Template not found
Error message
Template not found
What it means
Raised by the template-create helper when get_template_by_id cannot find a starter-project template with the given template_id. Templates come from the bundled starter_projects collection; the id must match the 'id' field inside that JSON exactly. 404.
Source
Thrown at src/backend/base/langflow/agentic/utils/template_create.py:48
template_id: str,
target_folder_id: UUID | None = None,
) -> dict[str, Any]:
"""Create a new flow from a starter template and return its id and UI link.
Args:
session: Active async DB session.
user_id: The owner user id for the new flow.
template_id: The string id field inside the starter template JSON.
target_folder_id: Optional folder id to place the flow. If not provided,
the user's default folder will be used.
Returns:
Dict with keys: {"id": str, "link": str}
"""
# 1) Load template JSON from starter_projects
template = get_template_by_id(template_id=template_id, fields=None)
if not template:
raise HTTPException(status_code=404, detail="Template not found")
# 2) Resolve target folder
if target_folder_id:
folder = await session.get(Folder, target_folder_id)
if not folder or folder.user_id != user_id:
raise HTTPException(status_code=400, detail="Invalid target folder")
folder_id = folder.id
else:
default_folder = await get_or_create_default_folder(session, user_id)
folder_id = default_folder.id
# 3) Build FlowCreate from template fields (ignore unknowns)
new_flow = FlowCreate(
name=template.get("name"),
description=template.get("description"),
icon=template.get("icon"),
icon_bg_color=template.get("icon_bg_color"),
gradient=template.get("gradient"),View on GitHub (pinned to 976ec789d2)
Solutions
- List available templates (GET /api/v1/starter-projects/ or the equivalent) and use an id from the response.
- Check the template_id spelling and case against the installed starter_projects JSON.
- After upgrading Langflow, re-verify template ids — they are version-dependent.
Example fix
# before
create_flow_from_template(template_id="basic_prompt")
# after
templates = client.get("/api/v1/starter-projects/").json()
create_flow_from_template(template_id=templates[0]["id"]) Defensive patterns
Strategy: validation
Validate before calling
templates = client.get("/api/v1/starter-projects/").json()
valid_ids = {t["id"] for t in (templates if isinstance(templates, list) else templates.get("templates", []))}
assert template_id in valid_ids, f"unknown template {template_id!r}; valid: {sorted(valid_ids)[:10]}..." Try / catch
try:
create_flow_from_template(template_id=tid)
except HTTPError as e:
if e.response.status_code == 404:
tid = pick_from_list_response() # re-resolve against installed set
create_flow_from_template(template_id=tid)
else:
raise Prevention
- Never hardcode template ids — fetch the installed list at runtime.
- Re-verify template ids after every Langflow upgrade.
- Template ids are case-sensitive; copy them exactly.
When it happens
Trigger: POSTing the create-from-template endpoint/MCP tool with a template_id that is not in starter_projects — typos, a template removed in the current version, or an id from the marketplace that is not bundled locally.
Common situations: Langflow upgrades renaming/removing starter templates; ids copied from online docs that differ from the installed version's set; case sensitivity ('basic-prompt' vs 'Basic-Prompt').
Related errors
- Failed to load file (HTTP ${status})
- reload-in-progress
- An error occurred while uploading the file
- Flow not found
- Build job not found
AI-assisted analysis of langflow-ai/langflow@976ec789d2 (2026-08-14).
Data as JSON: /api/errors/1ff2d0b23ab4e926.
Report an issue: GitHub.