{"record":{"id":"1ff2d0b23ab4e926","repo":"langflow-ai/langflow","slug":"template-not-found","errorCode":null,"errorMessage":"Template not found","messagePattern":"Template not found","errorType":"http","errorClass":"HTTPException","httpStatus":404,"severity":"error","filePath":"src/backend/base/langflow/agentic/utils/template_create.py","lineNumber":48,"sourceCode":"    template_id: str,\n    target_folder_id: UUID | None = None,\n) -> dict[str, Any]:\n    \"\"\"Create a new flow from a starter template and return its id and UI link.\n\n    Args:\n        session: Active async DB session.\n        user_id: The owner user id for the new flow.\n        template_id: The string id field inside the starter template JSON.\n        target_folder_id: Optional folder id to place the flow. If not provided,\n            the user's default folder will be used.\n\n    Returns:\n        Dict with keys: {\"id\": str, \"link\": str}\n    \"\"\"\n    # 1) Load template JSON from starter_projects\n    template = get_template_by_id(template_id=template_id, fields=None)\n    if not template:\n        raise HTTPException(status_code=404, detail=\"Template not found\")\n\n    # 2) Resolve target folder\n    if target_folder_id:\n        folder = await session.get(Folder, target_folder_id)\n        if not folder or folder.user_id != user_id:\n            raise HTTPException(status_code=400, detail=\"Invalid target folder\")\n        folder_id = folder.id\n    else:\n        default_folder = await get_or_create_default_folder(session, user_id)\n        folder_id = default_folder.id\n\n    # 3) Build FlowCreate from template fields (ignore unknowns)\n    new_flow = FlowCreate(\n        name=template.get(\"name\"),\n        description=template.get(\"description\"),\n        icon=template.get(\"icon\"),\n        icon_bg_color=template.get(\"icon_bg_color\"),\n        gradient=template.get(\"gradient\"),","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/langflow-ai/langflow/blob/976ec789d2886a86de109c044d089d68e96c9a35/src/backend/base/langflow/agentic/utils/template_create.py#L30-L66","documentation":"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.","triggerScenarios":"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.","commonSituations":"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').","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."],"exampleFix":"# before\ncreate_flow_from_template(template_id=\"basic_prompt\")\n\n# after\ntemplates = client.get(\"/api/v1/starter-projects/\").json()\ncreate_flow_from_template(template_id=templates[0][\"id\"])","handlingStrategy":"validation","validationCode":"templates = client.get(\"/api/v1/starter-projects/\").json()\nvalid_ids = {t[\"id\"] for t in (templates if isinstance(templates, list) else templates.get(\"templates\", []))}\nassert template_id in valid_ids, f\"unknown template {template_id!r}; valid: {sorted(valid_ids)[:10]}...\"","typeGuard":null,"tryCatchPattern":"try:\n    create_flow_from_template(template_id=tid)\nexcept HTTPError as e:\n    if e.response.status_code == 404:\n        tid = pick_from_list_response()  # re-resolve against installed set\n        create_flow_from_template(template_id=tid)\n    else:\n        raise","preventionTips":["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."],"tags":["templates","http-404","starter-projects"],"backgroundTag":null,"analyzedSha":"976ec789d2886a86de109c044d089d68e96c9a35","analyzedAt":"2026-08-14T18:23:12.227Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}