can1357/oh-my-pi · error · ValueError
model must be 'provider/model' (e.g. anthropic/claude-sonnet
Error message
model must be 'provider/model' (e.g. anthropic/claude-sonnet-4-6)
What it means
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.
Source
Thrown at packages/metaharness/agent/omp_local.py:545
env: dict[str, str] = {}
for key in _PROVIDER_KEYS.get(provider, []):
value = os.environ.get(key)
if value:
env[key] = value
return env
# ---------------------------------------------------------------------- run
@with_prompt_template
@override
async def run(
self,
instruction: str,
environment: BaseEnvironment,
context: AgentContext,
) -> None:
if not self.model_name or "/" not in self.model_name:
raise ValueError(
"model must be 'provider/model' (e.g. anthropic/claude-sonnet-4-6)"
)
provider, model = self.model_name.split("/", 1)
if self._binary:
parts = [shlex.quote(self._cli)]
else:
parts = [shlex.quote(self._bun), shlex.quote(self._cli)]
parts += [
"--print",
"--mode json",
f"--provider {shlex.quote(provider)}",
f"--model {shlex.quote(model)}",
"--no-session",
]
if self._auto_approve:
parts.append("--auto-approve")
if self._thinking:View on GitHub (pinned to 9690622007)
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'.
Example fix
# before agent = OmpLocalAgent(model_name="claude-sonnet-4-6") # after agent = OmpLocalAgent(model_name="anthropic/claude-sonnet-4-6")
Defensive patterns
Strategy: validation
Validate before calling
def ensure_provider_model(name):
if not name or "/" not in name:
raise ValueError(f"model must be 'provider/model', got {name!r}")
provider, model = name.split("/", 1)
return provider, model Type guard
def is_provider_model(name) -> bool:
return isinstance(name, str) and "/" in name and all(name.split("/", 1)) Try / catch
try:
await agent.run(instruction, env, ctx)
except ValueError as e:
if "provider/model" in str(e):
agent.model_name = f"anthropic/{agent.model_name}" # or reconfigure
return await agent.run(instruction, env, ctx)
raise Prevention
- 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/).
When it happens
Trigger: Calling run() with the agent constructed without a model, or with a bare model id like 'claude-sonnet-4-6' lacking the provider prefix.
Common situations: 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.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains an empty provider
- OMP_AUTH_BROKER_ACCOUNT_POOL_FILE contains a provider id wit
- ${name} path does not exist: ${trimmed}
- Anthropic thinking budget requires max_tokens greater than $
- cachedContent must not be blank
AI-assisted analysis of can1357/oh-my-pi@9690622007 (2026-08-31).
Data as JSON: /api/errors/56d7096509c6aab9.
Report an issue: GitHub.