{"record":{"id":"fb3e71f2dd511840","repo":"langchain-ai/langchain","slug":"loading-config-type-prompt-not-supported","errorCode":null,"errorMessage":"Loading {config_type} prompt not supported","messagePattern":"Loading (.+?) prompt not supported","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/core/langchain_core/prompts/loading.py","lineNumber":80,"sourceCode":"        allow_dangerous_paths: If `False` (default), file paths in the\n            config (such as `template_path`, `examples`, and\n            `example_prompt_path`) are validated to reject absolute paths\n            and directory traversal (`..`) sequences. Set to `True` only\n            if you trust the source of the config.\n\n    Returns:\n        A `PromptTemplate` object.\n\n    Raises:\n        ValueError: If the prompt type is not supported.\n    \"\"\"\n    if \"_type\" not in config:\n        logger.warning(\"No `_type` key found, defaulting to `prompt`.\")\n    config_type = config.pop(\"_type\", \"prompt\")\n\n    if config_type not in type_to_loader_dict:\n        msg = f\"Loading {config_type} prompt not supported\"\n        raise ValueError(msg)\n\n    prompt_loader = type_to_loader_dict[config_type]\n    return prompt_loader(config, allow_dangerous_paths=allow_dangerous_paths)\n\n\ndef _load_template(\n    var_name: str, config: dict[str, Any], *, allow_dangerous_paths: bool = False\n) -> dict[str, Any]:\n    \"\"\"Load template from the path if applicable.\"\"\"\n    # Check if template_path exists in config.\n    if f\"{var_name}_path\" in config:\n        # If it does, make sure template variable doesn't also exist.\n        if var_name in config:\n            msg = f\"Both `{var_name}_path` and `{var_name}` cannot be provided.\"\n            raise ValueError(msg)\n        # Pop the template path from the config.\n        template_path = Path(config.pop(f\"{var_name}_path\"))\n        if not allow_dangerous_paths:","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/langchain-ai/langchain/blob/e32fa9a52eab3b61ad7a45399bfde59b3e580fc4/libs/core/langchain_core/prompts/loading.py#L62-L98","documentation":"`load_prompt_from_config` looks up the config's `_type` key in `type_to_loader_dict`, which only contains `prompt`, `few_shot`, and `chat`. Any other `_type` (or a typo) raises `ValueError: Loading {config_type} prompt not supported`. Note the loader set is intentionally small in core; richer prompt types were supported by legacy `langchain` loaders.","triggerScenarios":"Loading a config JSON with `\"_type\": \"prompt_with_format\"`, `\"_type\": \"pipeline\"`, or any string not in {prompt, few_shot, chat}. Also triggered when `_type` is missing — it defaults to `prompt` only via a warning, but an explicit unknown value always fails.","commonSituations":"Loading prompt files exported from old langchain versions or the Hub that used extended types; hand-written configs with guessed type names; team configs that assumed legacy loader support.","solutions":["Change `_type` to one of the supported values: `prompt`, `few_shot`, or `chat`.","Rebuild the prompt programmatically (e.g. `PromptTemplate.from_template(...)` or `ChatPromptTemplate.from_messages(...)`) and serialize with `dumpd`/`dumps` from `langchain_core.load` instead.","If the config came from the deprecated Hub format, re-create it on LangSmith Hub and pull from there."],"exampleFix":"# before\n# config.json: {\"_type\": \"prompt_with_format\", \"template\": \"Hi {name}\"}\nload_prompt('config.json')  # ValueError\n\n# after\n# config.json: {\"_type\": \"prompt\", \"template\": \"Hi {name}\", \"input_variables\": [\"name\"]}\nload_prompt('config.json')","handlingStrategy":"validation","validationCode":"import json\nSUPPORTED = {'prompt', 'few_shot', 'chat'}\nconfig = json.loads(Path('prompt.json').read_text())\nif config.get('_type', 'prompt') not in SUPPORTED:\n    raise ValueError(f\"unsupported _type {config.get('_type')!r}; expected one of {SUPPORTED}\")\nload_prompt('prompt.json')","typeGuard":"def is_supported_prompt_type(config: dict) -> bool:\n    return config.get('_type', 'prompt') in {'prompt', 'few_shot', 'chat'}","tryCatchPattern":null,"preventionTips":["Validate `_type` against the supported set when ingesting external prompt files.","Prefer langchain_core.load.dumpd/load serialization for anything beyond the three legacy types."],"tags":["prompts","loading","config","valueerror"],"backgroundTag":null,"analyzedSha":"e32fa9a52eab3b61ad7a45399bfde59b3e580fc4","analyzedAt":"2026-08-14T18:42:09.092Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}