{"record":{"id":"c232b34f6cb37fd4","repo":"langchain-ai/deepagents","slug":"invalid-class-path-class-path-must-be-in-modu","errorCode":null,"errorMessage":"Invalid class_path '{class_path}': must be in module.path:ClassName format","messagePattern":"Invalid class_path '(.+?)': must be in module\\.path:ClassName format","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/integrations/sandbox_registry.py","lineNumber":101,"sourceCode":"def _load_class(class_path: str) -> type:\n    \"\"\"Import a `module.path:ClassName` provider class.\n\n    Args:\n        class_path: Fully-qualified class path.\n\n    Returns:\n        The imported class object.\n\n    Raises:\n        ValueError: If `class_path` is malformed.\n        ImportError: If the module cannot be imported or lacks the class.\n    \"\"\"\n    if \":\" not in class_path:\n        msg = (\n            f\"Invalid class_path '{class_path}': must be in \"\n            \"module.path:ClassName format\"\n        )\n        raise ValueError(msg)\n    module_path, class_name = class_path.rsplit(\":\", 1)\n    module = importlib.import_module(module_path)\n    cls = getattr(module, class_name, None)\n    if cls is None or not isinstance(cls, type):\n        msg = f\"Class '{class_name}' not found in module '{module_path}'\"\n        raise ImportError(msg)\n    return cls\n\n\ndef _provider_metadata(provider: SandboxProvider, name: str) -> SandboxProviderMetadata:\n    \"\"\"Extract metadata from a provider instance or class.\n\n    Providers may expose a `metadata` attribute/property; otherwise a minimal\n    default is synthesized.\n\n    Args:\n        provider: Provider instance.\n        name: Provider name to use when synthesizing defaults.","sourceCodeStart":83,"sourceCodeEnd":119,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/integrations/sandbox_registry.py#L83-L119","documentation":"`_load_class` resolves a dynamically configured sandbox provider from a `module.path:ClassName` string. A class_path without a `:` separator cannot be split into module and class parts, so a ValueError is raised explaining the required format.","triggerScenarios":"Configuring a sandbox provider with `class_path` values like `'mypkg.MyProvider'`, `'MyProvider'`, or a Windows-style path — anything lacking `:`, passed through `create_provider`/`_get_provider`.","commonSituations":"Typos in config files where `.` was used instead of `:`, copying a fully-qualified name from an IDE that uses dot notation, misunderstanding the documented format.","solutions":["Rewrite class_path as `module.path:ClassName`, e.g. `mypackage.providers:MyProvider`.","Validate config at load time with a regex like `^[\\w.]+:[\\w]+$`.","Check the provider config documentation for the exact separator."],"exampleFix":"# before\nclass_path = \"mypackage.providers.MyProvider\"\n# after\nclass_path = \"mypackage.providers:MyProvider\"","handlingStrategy":"validation","validationCode":"import re\n\ndef is_valid_class_path(class_path: str) -> bool:\n    return re.fullmatch(r'[\\w.]+:[\\w]+', class_path) is not None","typeGuard":null,"tryCatchPattern":"try:\n    provider = registry.create_provider(name)\nexcept ValueError as exc:\n    raise ConfigError(f'Fix sandbox provider config: {exc}') from exc","preventionTips":["Always use module.path:ClassName format with a colon separator","Validate class_path with a regex when loading config","Copy qualified names from Python (Module.CLASS) not from dotted IDE hints"],"tags":["python","config","validation","dynamic-import"],"backgroundTag":"invalid-configuration-format","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}