{"record":{"id":"d5c4d39cc8911f3d","repo":"langchain-ai/deepagents","slug":"profile-key-key-r-has-whitespace-adjacent-to","errorCode":null,"errorMessage":"Profile key {key!r} has whitespace adjacent to ':'; expected 'provider:model' with no spaces around ':'.","messagePattern":"Profile key (.+?) has whitespace adjacent to ':'; expected 'provider:model' with no spaces around ':'\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/deepagents/deepagents/profiles/_keys.py","lineNumber":42,"sourceCode":"            an empty half on either side of `:`.\n    \"\"\"\n    if not key:\n        msg = \"Profile key must be a non-empty string.\"\n        raise ValueError(msg)\n    if key != key.strip():\n        msg = f\"Profile key {key!r} has leading or trailing whitespace; expected 'provider' or 'provider:model'.\"\n        raise ValueError(msg)\n    if key.count(\":\") > 1:\n        msg = f\"Profile key {key!r} has more than one ':'; expected 'provider' or 'provider:model'.\"\n        raise ValueError(msg)\n    if \":\" in key:\n        provider, _, model = key.partition(\":\")\n        if not provider or not model:\n            msg = f\"Profile key {key!r} has an empty provider or model half; expected 'provider:model'.\"\n            raise ValueError(msg)\n        if provider != provider.strip() or model != model.strip():\n            msg = f\"Profile key {key!r} has whitespace adjacent to ':'; expected 'provider:model' with no spaces around ':'.\"\n            raise ValueError(msg)\n","sourceCodeStart":24,"sourceCodeEnd":43,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/deepagents/deepagents/profiles/_keys.py#L24-L43","documentation":"In 'provider:model' keys, whitespace adjacent to the ':' is rejected: both halves must already be stripped. This keeps 'a: b' and 'a:b' distinct-but-both-invalid, forcing canonical keys.","triggerScenarios":"Building a key with a separator like ' : ' (e.g. f\"{provider} : {model}\") or joining user-entered fields without stripping.","commonSituations":"Pretty-printed config values copied verbatim ('anthropic: claude-3'); template strings with spaces around ':'; form input fields with stray spaces.","solutions":["Strip each half before joining: f\"{provider.strip()}:{model.strip()}\".","Normalize the config value (no space after ':' in the key value).","Prefer yaml/json structured provider/model fields over manual string joining."],"exampleFix":"// before\nkey = \"anthropic : claude-3\"\n// after\nkey = \"anthropic:claude-3\"","handlingStrategy":"validation","validationCode":"key = \":\".join(p.strip() for p in key.split(\":\"))","typeGuard":null,"tryCatchPattern":"try:\n    register_provider_profile(key)\nexcept ValueError as e:\n    if \"whitespace adjacent to ':'\" in str(e):\n        key = key.replace(\" \", \"\")\n    else:\n        raise","preventionTips":["Strip each half before joining provider and model","Avoid hand-written ' : ' separators in configs; use structured fields"],"tags":["python","profiles","whitespace"],"backgroundTag":"invalid-profile-key","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}