{"record":{"id":"3065f9df8d59b697","repo":"langchain-ai/deepagents","slug":"invalid-class-path-class-path-for-provider-p","errorCode":null,"errorMessage":"Invalid class_path '{class_path}' for provider '{provider}': must be in module.path:ClassName format","messagePattern":"Invalid class_path '(.+?)' for provider '(.+?)': must be in module\\.path:ClassName format","errorType":"validation","errorClass":"ModelConfigError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/config.py","lineNumber":5378,"sourceCode":"    Returns:\n        Instantiated `BaseChatModel`.\n\n    Raises:\n        ModelConfigError: If the class cannot be imported, is not a\n            `BaseChatModel` subclass, or fails to instantiate.\n    \"\"\"\n    from langchain_core.language_models import (\n        BaseChatModel as _BaseChatModel,  # Runtime import; module level is typing only\n    )\n\n    from deepagents_code.model_config import ModelConfigError\n\n    if \":\" not in class_path:\n        msg = (\n            f\"Invalid class_path '{class_path}' for provider '{provider}': \"\n            \"must be in module.path:ClassName format\"\n        )\n        raise ModelConfigError(msg)\n\n    module_path, class_name = class_path.rsplit(\":\", 1)\n\n    try:\n        module = importlib.import_module(module_path)\n    except ImportError as e:\n        msg = f\"Could not import module '{module_path}' for provider '{provider}': {e}\"\n        raise ModelConfigError(msg) from e\n\n    cls = getattr(module, class_name, None)\n    if cls is None:\n        msg = (\n            f\"Class '{class_name}' not found in module '{module_path}' \"\n            f\"for provider '{provider}'\"\n        )\n        raise ModelConfigError(msg)\n\n    if not (isinstance(cls, type) and issubclass(cls, _BaseChatModel)):","sourceCodeStart":5360,"sourceCodeEnd":5396,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/config.py#L5360-L5396","documentation":"Raised when a custom-model `class_path` configured for a provider lacks the required `module.path:ClassName` separator format. `_create_model_from_class` splits with `rsplit(':', 1)`, so a colon is mandatory; dot-only paths like `mypkg.models.MyModel` cannot be resolved to a module plus attribute.","triggerScenarios":"A custom model class configured in config.toml (`class_path = \"my_pkg.models.MyChatModel\"`) is passed to `_create_model_from_class`, and the value contains no `:` character (config.py:5373-5378).","commonSituations":"Copying a plain dotted Python import path into config instead of the `module:attr` form; dropping the class name entirely; confusing this field with a provider name or a file path.","solutions":["Rewrite the value as `module.path:ClassName`, e.g. `class_path = \"my_pkg.models:MyChatModel\"`","Verify exactly one attribute name follows the colon","Ensure the class after the colon is an actual exported symbol"],"exampleFix":"// before (config.toml)\n[providers.custom]\nclass_path = \"my_pkg.models.MyChatModel\"\n\n// after\n[providers.custom]\nclass_path = \"my_pkg.models:MyChatModel\"","handlingStrategy":"validation","validationCode":"def valid_class_path(class_path: str) -> bool:\n    return \":\" in class_path and class_path.rsplit(\":\", 1)[0] and class_path.rsplit(\":\", 1)[1]","typeGuard":"def parse_class_path(class_path: str) -> tuple[str, str] | None:\n    if \":\" not in class_path:\n        return None\n    module_path, class_name = class_path.rsplit(\":\", 1)\n    return (module_path, class_name) if module_path and class_name else None","tryCatchPattern":"from deepagents_code.model_config import ModelConfigError\ntry:\n    model = create_model(spec, class_path=class_path)\nexcept ModelConfigError as e:\n    if \"must be in module.path:ClassName format\" in str(e):\n        class_path = f\"{class_path.rsplit('.', 1)[0]}:{class_path.rsplit('.', 1)[1]}\"\n        model = create_model(spec, class_path=class_path)\n    else:\n        raise","preventionTips":["Use `module:attr` (colon) form for class_path, never a dotted-only path","Validate config.toml with a startup check before shipping to a team","Copy the class_path from `python -c \"import mod; print(mod.MyClass.__module__)\"`-style introspection"],"tags":["config","import","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}