{"record":{"id":"56d7096509c6aab9","repo":"can1357/oh-my-pi","slug":"model-must-be-provider-model-e-g-anthropic-cla","errorCode":null,"errorMessage":"model must be 'provider/model' (e.g. anthropic/claude-sonnet-4-6)","messagePattern":"model must be 'provider/model' \\(e\\.g\\. anthropic/claude-sonnet-4-6\\)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"packages/metaharness/agent/omp_local.py","lineNumber":545,"sourceCode":"        env: dict[str, str] = {}\n        for key in _PROVIDER_KEYS.get(provider, []):\n            value = os.environ.get(key)\n            if value:\n                env[key] = value\n        return env\n\n    # ---------------------------------------------------------------------- run\n\n    @with_prompt_template\n    @override\n    async def run(\n        self,\n        instruction: str,\n        environment: BaseEnvironment,\n        context: AgentContext,\n    ) -> None:\n        if not self.model_name or \"/\" not in self.model_name:\n            raise ValueError(\n                \"model must be 'provider/model' (e.g. anthropic/claude-sonnet-4-6)\"\n            )\n        provider, model = self.model_name.split(\"/\", 1)\n\n        if self._binary:\n            parts = [shlex.quote(self._cli)]\n        else:\n            parts = [shlex.quote(self._bun), shlex.quote(self._cli)]\n        parts += [\n            \"--print\",\n            \"--mode json\",\n            f\"--provider {shlex.quote(provider)}\",\n            f\"--model {shlex.quote(model)}\",\n            \"--no-session\",\n        ]\n        if self._auto_approve:\n            parts.append(\"--auto-approve\")\n        if self._thinking:","sourceCodeStart":527,"sourceCodeEnd":563,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/metaharness/agent/omp_local.py#L527-L563","documentation":"OmpLocalAgent.run requires self.model_name in 'provider/model' form because it splits on '/' to derive the CLI --provider and --model arguments. If model_name is missing (None/empty) or contains no slash, run raises this ValueError before launching the agent.","triggerScenarios":"Calling run() with the agent constructed without a model, or with a bare model id like 'claude-sonnet-4-6' lacking the provider prefix.","commonSituations":"Config file/env omitted the model; user specified only the model name assuming a default provider; programmatic use passed a raw model id without the anthropic/ or openai/ prefix.","solutions":["Set the model to a fully qualified 'provider/model' string, e.g. anthropic/claude-sonnet-4-6.","Pass the model at construction time of OmpLocalAgent (or via its config/env) so model_name is populated.","Validate the model string at startup rather than inside run to fail earlier.","If your model id itself contains no slash, prefix the provider: e.g. 'openai/gpt-5'."],"exampleFix":"# before\nagent = OmpLocalAgent(model_name=\"claude-sonnet-4-6\")\n# after\nagent = OmpLocalAgent(model_name=\"anthropic/claude-sonnet-4-6\")","handlingStrategy":"validation","validationCode":"def ensure_provider_model(name):\n    if not name or \"/\" not in name:\n        raise ValueError(f\"model must be 'provider/model', got {name!r}\")\n    provider, model = name.split(\"/\", 1)\n    return provider, model","typeGuard":"def is_provider_model(name) -> bool:\n    return isinstance(name, str) and \"/\" in name and all(name.split(\"/\", 1))","tryCatchPattern":"try:\n    await agent.run(instruction, env, ctx)\nexcept ValueError as e:\n    if \"provider/model\" in str(e):\n        agent.model_name = f\"anthropic/{agent.model_name}\"  # or reconfigure\n        return await agent.run(instruction, env, ctx)\n    raise","preventionTips":["Always configure models as provider/model at construction time.","Validate the model string in config loading, not at run time.","Never pass bare model ids; prefix with the provider (anthropic/, openai/)."],"tags":["configuration","validation","argument-format"],"backgroundTag":"invalid-argument-format","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}