langchain-ai/deepagents · error · ValueError

Profile key {key!r} has more than one ':'; expected 'provide

Error message

Profile key {key!r} has more than one ':'; expected 'provider' or 'provider:model'.

What it means

A profile key may contain at most one ':' separating provider from model ('provider:model'). validate_profile_key raises when key.count(':') > 1, since a second colon makes the key ambiguous under the two-segment scheme.

Source

Thrown at libs/deepagents/deepagents/profiles/_keys.py:34

    halves, multiple colons, and empty halves.

    Args:
        key: The registry key to check.

    Raises:
        ValueError: If `key` is empty, contains leading/trailing whitespace,
            has more than one `:`, has whitespace adjacent to `:`, or has
            an empty half on either side of `:`.
    """
    if not key:
        msg = "Profile key must be a non-empty string."
        raise ValueError(msg)
    if key != key.strip():
        msg = f"Profile key {key!r} has leading or trailing whitespace; expected 'provider' or 'provider:model'."
        raise ValueError(msg)
    if key.count(":") > 1:
        msg = f"Profile key {key!r} has more than one ':'; expected 'provider' or 'provider:model'."
        raise ValueError(msg)
    if ":" in key:
        provider, _, model = key.partition(":")
        if not provider or not model:
            msg = f"Profile key {key!r} has an empty provider or model half; expected 'provider:model'."
            raise ValueError(msg)
        if provider != provider.strip() or model != model.strip():
            msg = f"Profile key {key!r} has whitespace adjacent to ':'; expected 'provider:model' with no spaces around ':'."
            raise ValueError(msg)

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Reduce the key to two segments: 'provider:model'.
  2. Encode extra qualifiers into the model segment only if allowed (no further colons).
  3. Use a different field for the extra qualifier instead of the key.

Example fix

// before
register_provider_profile("anthropic:claude-3:latest")
// after
register_provider_profile("anthropic:claude-3-latest")
Defensive patterns

Strategy: validation

Validate before calling

if key.count(":") > 1:
    raise ValueError(f"profile key {key!r} must be 'provider' or 'provider:model'")

Try / catch

try:
    register_provider_profile(key)
except ValueError as e:
    if "more than one ':'" in str(e):
        provider, model = key.split(":", 1)  # or fix source data
    else:
        raise

Prevention

When it happens

Trigger: Passing keys like 'anthropic:model:v2', a full URL 'https://api.x.com', or a Windows-style path as the profile key to a register/lookup API.

Common situations: Concatenating model tags or versions onto a model name; pasting endpoint URLs or qualified identifiers into the profile-name field.

Related errors


AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29). Data as JSON: /api/errors/1f41139b38495c95. Report an issue: GitHub.