{"record":{"id":"38dd068fe81da9f4","repo":"mlflow/mlflow","slug":"cannot-load-runnable-without-a-config-file-got-pa","errorCode":null,"errorMessage":"Cannot load runnable without a config file. Got path {config_path}.","messagePattern":"Cannot load runnable without a config file\\. Got path (.+?)\\.","errorType":"exception","errorClass":"MlflowException","httpStatus":null,"severity":"error","filePath":"mlflow/langchain/runnables.py","lineNumber":75,"sourceCode":"\n@patch_langchain_type_to_cls_dict\ndef _load_model_from_config(path, model_config):\n    from langchain.chains.loading import type_to_loader_dict as chains_type_to_loader_dict\n    from langchain.llms import get_type_to_cls_dict as llms_get_type_to_cls_dict\n\n    try:\n        from langchain.prompts.loading import type_to_loader_dict as prompts_types\n    except ImportError:\n        prompts_types = {\"prompt\", \"few_shot_prompt\"}\n\n    config_path = os.path.join(path, model_config.get(_MODEL_DATA_KEY, _MODEL_DATA_YAML_FILE_NAME))\n    # Load runnables from config file\n    if config_path.endswith(\".yaml\"):\n        config = _load_from_yaml(config_path)\n    elif config_path.endswith(\".json\"):\n        config = _load_from_json(config_path)\n    else:\n        raise MlflowException(\n            f\"Cannot load runnable without a config file. Got path {config_path}.\"\n        )\n    _type = config.get(\"_type\")\n    if _type in chains_type_to_loader_dict:\n        from langchain.chains.loading import load_chain\n\n        return _patch_loader(load_chain)(config_path)\n    elif _type in prompts_types:\n        from langchain.prompts.loading import load_prompt\n\n        return load_prompt(config_path)\n    elif _type in llms_get_type_to_cls_dict():\n        from langchain_community.llms.loading import load_llm\n\n        return _patch_loader(load_llm)(config_path)\n    elif _type in custom_type_to_loader_dict():\n        return custom_type_to_loader_dict()[_type](config)\n    raise MlflowException(f\"Unsupported type {_type} for loading.\")","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/mlflow/mlflow/blob/6a27f2decc0b76eb1b54af31849784addb357dbc/mlflow/langchain/runnables.py#L57-L93","documentation":"MLflow's runnable loader (_load_model_from_config) reconstructs a LangChain runnable from a YAML or JSON config file saved alongside the model. If the given config_path ends in neither `.yaml` nor `.json`, MLflow cannot parse it and raises this MlflowException. The config file is the sole source of the runnable's `_type` and structure.","triggerScenarios":"Calling _load_model_from_config (via _load_model_from_path / _save_internal_runnables round-trip) with a path to a `.yml`, `.txt`, `.pkl`, or extensionless file, or to a directory instead of a config file.","commonSituations":"Renaming the saved config file (config.yaml -> config.yml); pointing the loader at the model directory instead of the config file; custom save pipelines writing JSON with an unusual extension.","solutions":["Point config_path at the actual saved config file with a .yaml or .json extension (typically `<model_path>/model.yaml`).","Rename the config file to end in .yaml or .json if it was renamed.","If the model was saved as pickle, use the pickle load key path instead of the config loader."],"exampleFix":"// before\nmodel = _load_model_from_config(\"models/runnable.yml\")\n// after\nmodel = _load_model_from_config(\"models/runnable.yaml\")","handlingStrategy":"validation","validationCode":"p = pathlib.Path(config_path)\nassert p.is_file() and p.suffix in (\".yaml\", \".json\"), f\"need .yaml/.json config, got {config_path}\"","typeGuard":"def is_valid_config_path(path: str) -> bool:\n    p = pathlib.Path(path)\n    return p.is_file() and p.suffix.lower() in {\".yaml\", \".json\"}","tryCatchPattern":"try:\n    model = _load_model_from_config(config_path)\nexcept MlflowException as e:\n    if \"without a config file\" in str(e):\n        config_path = str(pathlib.Path(config_path).with_suffix(\".yaml\"))\n        model = _load_model_from_config(config_path)\n    else:\n        raise","preventionTips":["Never rename mlflow-written config files (keep .yaml extension, not .yml).","Pass the config file path, not the model directory.","Verify file extension before load in scripts."],"tags":["langchain","mlflow","file-path","config"],"backgroundTag":"unsupported-file-extension","analyzedSha":"6a27f2decc0b76eb1b54af31849784addb357dbc","analyzedAt":"2026-08-29T20:54:51.419Z","schemaVersion":2},"datasetVersion":"2026-08-29T22:17:34.462Z"}