{"record":{"id":"e0b5e0287598574d","repo":"huggingface/smolagents","slug":"this-tool-does-not-implement-a-default-checkpoint","errorCode":null,"errorMessage":"This tool does not implement a default checkpoint, you need to pass one.","messagePattern":"This tool does not implement a default checkpoint, you need to pass one\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/smolagents/tools.py","lineNumber":1237,"sourceCode":"    def __init__(\n        self,\n        model=None,\n        pre_processor=None,\n        post_processor=None,\n        device=None,\n        device_map=None,\n        model_kwargs=None,\n        token=None,\n        **hub_kwargs,\n    ):\n        if not _is_package_available(\"accelerate\") or not _is_package_available(\"torch\"):\n            raise ModuleNotFoundError(\n                \"Please install 'transformers' extra to use a PipelineTool: `pip install 'smolagents[transformers]'`\"\n            )\n\n        if model is None:\n            if self.default_checkpoint is None:\n                raise ValueError(\"This tool does not implement a default checkpoint, you need to pass one.\")\n            model = self.default_checkpoint\n        if pre_processor is None:\n            pre_processor = model\n\n        self.model = model\n        self.pre_processor = pre_processor\n        self.post_processor = post_processor\n        self.device = device\n        self.device_map = device_map\n        self.model_kwargs = {} if model_kwargs is None else model_kwargs\n        if device_map is not None:\n            self.model_kwargs[\"device_map\"] = device_map\n        self.hub_kwargs = hub_kwargs\n        self.hub_kwargs[\"token\"] = token\n\n        super().__init__()\n\n    def setup(self):","sourceCodeStart":1219,"sourceCodeEnd":1255,"githubUrl":"https://github.com/huggingface/smolagents/blob/30bb1161095dbae2271e6bc3cc4c219cc3897a57/src/smolagents/tools.py#L1219-L1255","documentation":"A PipelineTool needs a model checkpoint. If `model` is not passed and the subclass does not define `default_checkpoint`, __init__ cannot determine what to load and raises ValueError immediately.","triggerScenarios":"Creating a PipelineTool subclass whose class body sets `default_checkpoint = None` (or never defines it) without passing `model=...`, e.g. `MyPipeTool()` with no arguments.","commonSituations":"Writing custom PipelineTool subclasses and forgetting the default_checkpoint class attribute; refactoring a subclass and deleting the default; expecting the base class to auto-select a checkpoint.","solutions":["Pass an explicit checkpoint: `MyTool(model='repo/model-name')`","Define `default_checkpoint = 'org/model-name'` as a class attribute on the subclass","If the tool is intentionally checkpoint-less, reconsider subclassing PipelineTool vs plain Tool"],"exampleFix":"# before\nclass MyTranslator(PipelineTool):\n    pass  # no default_checkpoint\nMyTranslator()\n# after\nclass MyTranslator(PipelineTool):\n    default_checkpoint = \"Helsinki-NLP/opus-mt-en-fr\"\nMyTranslator()","handlingStrategy":"validation","validationCode":"if getattr(MyPipelineTool, \"default_checkpoint\", None) is None and checkpoint is None:\n    checkpoint = \"org/default-model\"  # your fallback\nmy_tool = MyPipelineTool(model=checkpoint)","typeGuard":"def has_checkpoint(tool_cls, model=None) -> bool:\n    return model is not None or getattr(tool_cls, \"default_checkpoint\", None) is not None","tryCatchPattern":"try:\n    tool = MyPipelineTool()\nexcept ValueError as e:\n    if \"default checkpoint\" in str(e):\n        tool = MyPipelineTool(model=\"org/default-model\")\n    else:\n        raise","preventionTips":["Always define default_checkpoint on PipelineTool subclasses","Pass model= explicitly in tests and dynamic instantiation","Document required checkpoints for custom tools"],"tags":["pipelinetool","checkpoint","configuration"],"backgroundTag":"missing-required-argument","analyzedSha":"30bb1161095dbae2271e6bc3cc4c219cc3897a57","analyzedAt":"2026-08-28T18:52:54.169Z","schemaVersion":2},"datasetVersion":"2026-08-28T21:17:43.275Z"}