{"record":{"id":"eb45cea00abd09e3","repo":"langchain-ai/deepagents","slug":"expected-label-value-got-value-r","errorCode":null,"errorMessage":"expected {label} value, got {value!r}","messagePattern":"expected (.+?) value, got (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"libs/talon/deepagents_talon/channels/base.py","lineNumber":397,"sourceCode":"        ValueError: If `value` is not an integer.\n    \"\"\"\n    return _parse_number(int, value, default, label=\"integer\")\n\n\ndef _parse_number[T](\n    convert: Callable[[str], T],\n    value: str | None,\n    default: T,\n    *,\n    label: str,\n) -> T:\n    if value is None:\n        return default\n    try:\n        return convert(value)  # type: ignore[return-value]\n    except ValueError as error:\n        msg = f\"expected {label} value, got {value!r}\"\n        raise ValueError(msg) from error\n\n\ndef split_csv(value: str) -> list[str]:\n    \"\"\"Split a comma-separated environment value.\n\n    Args:\n        value: Raw comma-separated value.\n\n    Returns:\n        Non-empty, stripped items.\n    \"\"\"\n    return [item.strip() for item in value.split(\",\") if item.strip()]\n\n\ndef optional_str(value: object) -> str | None:\n    \"\"\"Return a non-empty string value, or ``None``.\n\n    Args:","sourceCodeStart":379,"sourceCodeEnd":415,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/talon/deepagents_talon/channels/base.py#L379-L415","documentation":"`_parse_number` is the shared helper behind `parse_float` and `parse_int` for optional numeric environment values. When the string cannot be converted, it raises a ValueError saying what kind of value was expected and what was received. It returns the default only when the env value is absent (`None`), not when it is malformed.","triggerScenarios":"Calling `parse_float`/`parse_int` (used by `from_talon_config` for provider settings like timeouts/poll intervals) with an env string that `float()`/`int()` cannot parse, e.g. `'30s'`, `'1,5'`, or `'high'`.","commonSituations":"Including units (`30s`, `5m`) in numeric env vars; locale decimal commas; booleans or words where numbers are expected.","solutions":["Set a bare numeric value (`30`, `1.5`) without units or thousand separators.","Remove the variable so the documented default applies.","Catch the ValueError at startup to report the misconfigured variable name and value."],"exampleFix":"# before\nDEEPAGENTS_TALON_TELEGRAM_TIMEOUT=30s\n\n# after\nDEEPAGENTS_TALON_TELEGRAM_TIMEOUT=30","handlingStrategy":"validation","validationCode":"import os, re\ndef require_number(name: str) -> None:\n    raw = os.environ.get(name)\n    if raw is not None and not re.fullmatch(r'-?[0-9]+(\\.[0-9]+)?', raw.strip()):\n        raise SystemExit(f'{name} must be a plain number, got {raw!r}')","typeGuard":null,"tryCatchPattern":"try:\n    timeout = parse_int(env.get('MY_TIMEOUT'), 30)\nexcept ValueError as exc:\n    raise SystemExit(f'bad config: {exc}') from exc","preventionTips":["Never include units in numeric env vars; put the unit in the var name (TIMEOUT_SECONDS).","Use dots for decimals, never locale commas.","Wrap parse_float/parse_int calls in a startup config loader that reports the variable name."],"tags":["config","env","parsing"],"backgroundTag":"invalid-env-var-value","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}