langchain-ai/deepagents · error · ValueError

{config.provider} self exposure requires {operator_var}; set

Error message

{config.provider} self exposure requires {operator_var}; set {exposure_var}=allowlist or open for other modes

What it means

Talon channels are built from environment variables; when a provider channel uses `self` exposure mode (only the operator's own messages trigger the agent), at least one operator id must be configured. `channel_exposure_from_env` raises this ValueError when `require_self_operator` is set for the provider and the `<PREFIX>_OPERATOR_ID` env var is empty while mode is `self`. It also hints that other senders can be allowed by switching the exposure var to `allowlist` or `open`.

Source

Thrown at libs/talon/deepagents_talon/channels/base.py:204

        Parsed exposure policy.

    Raises:
        ValueError: If the exposure mode is invalid or risk acknowledgement is missing.
    """
    prefix = config.env_prefix
    exposure_var = f"{prefix}_EXPOSURE"
    operator_var = f"{prefix}_OPERATOR_ID"
    mode = _exposure_mode(
        env.get(exposure_var, ExposureMode.SELF.value),
        provider=config.provider,
    )
    operator_ids = frozenset(split_csv(env.get(operator_var, "")))
    if mode == ExposureMode.SELF and config.require_self_operator and not operator_ids:
        msg = (
            f"{config.provider} self exposure requires {operator_var}; "
            f"set {exposure_var}=allowlist or open for other modes"
        )
        raise ValueError(msg)
    if mode == ExposureMode.OPEN:
        _require_open_acknowledgement(env, config)
        logger.warning(
            "%s open exposure enabled; arbitrary senders can trigger the agent with "
            "operator credentials and local host access",
            config.provider,
        )
    return ChannelExposure(
        mode=mode,
        conversations=frozenset(split_csv(env.get(f"{prefix}_ALLOWLIST_CHATS", ""))),
        mention_patterns=tuple(split_csv(env.get(f"{prefix}_MENTION_PATTERNS", ""))),
        operator_ids=operator_ids,
    )


def outbound_media_root_from_env(env: Mapping[str, str]) -> Path:
    """Return the trusted outbound media root for channel attachments.

View on GitHub (pinned to a1af029e6e)

Solutions

  1. Set the operator env var, e.g. `DEEPAGENTS_TALON_TELEGRAM_OPERATOR_ID=<your-chat-or-user-id>`.
  2. If you want other senders, set `<PREFIX>_EXPOSURE=allowlist` and configure allowed conversations, or `open` with the risk acknowledgement var.
  3. Verify the env prefix matches the provider's `ChannelExposureEnv.env_prefix` so the correct var name is read.

Example fix

# before
DEEPAGENTS_TALON_TELEGRAM_EXPOSURE=self
# (no operator id set)

# after
DEEPAGENTS_TALON_TELEGRAM_EXPOSURE=self
DEEPAGENTS_TALON_TELEGRAM_OPERATOR_ID=123456789
Defensive patterns

Strategy: validation

Validate before calling

import os
prefix = 'DEEPAGENTS_TALON_TELEGRAM'
mode = os.environ.get(f'{prefix}_EXPOSURE', 'self')
if mode == 'self' and not os.environ.get(f'{prefix}_OPERATOR_ID', '').strip():
    raise SystemExit(f'{prefix}_OPERATOR_ID is required when {prefix}_EXPOSURE=self')

Try / catch

try:
    exposure = channel_exposure_from_env(env, config)
except ValueError as exc:
    logging.error('bad channel exposure config: %s', exc)
    raise SystemExit(2) from exc

Prevention

When it happens

Trigger: Calling `channel_exposure_from_env(env, config)` (via `from_talon_config`) where the resolved exposure mode is `ExposureMode.SELF` (the default), `config.require_self_operator` is True, and `env[f'{prefix}_OPERATOR_ID']` is unset or an empty/CSV-blank string.

Common situations: Deploying a Telegram/WhatsApp channel with `DEEPAGENTS_TALON_TELEGRAM_EXPOSURE=self` (or no exposure var at all, since self is default) but forgetting to set `DEEPAGENTS_TALON_TELEGRAM_OPERATOR_ID`; renaming prefixes between versions; typos in the operator id env var name.

Understand the failure class

Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.

Related errors


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