tinyhumansai/openhuman · error

telegram channel config is missing in config.toml

Error message

telegram channel config is missing in config.toml

What it means

When persisting a Telegram identity, `ConfigAllowlistStore` loads `~/.openhuman/config.toml` and mutates `config.channels_config.telegram.allowed_users`. The `as_mut()` returning None means the `[channels.telegram]` section is absent from the file, and the store bails rather than implicitly creating the section — it will not invent channel config it was never given.

Source

Thrown at src/openhuman/channels/host/adapters.rs:303

        }

        let home = directories::UserDirs::new()
            .map(|u| u.home_dir().to_path_buf())
            .context("could not find home directory")?;
        let openhuman_dir = home.join(".openhuman");
        let config_path = openhuman_dir.join("config.toml");
        let contents = tokio::fs::read_to_string(&config_path)
            .await
            .with_context(|| format!("failed to read config file: {}", config_path.display()))?;
        let mut config: Config =
            toml::from_str(&contents).context("failed to parse config.toml for allowlist")?;
        config.config_path = config_path;
        config.workspace_dir = openhuman_dir.join("workspace");

        match channel {
            "telegram" => {
                let Some(telegram) = config.channels_config.telegram.as_mut() else {
                    anyhow::bail!("telegram channel config is missing in config.toml");
                };
                if !telegram.allowed_users.iter().any(|u| u == &normalized) {
                    telegram.allowed_users.push(normalized);
                    config
                        .save()
                        .await
                        .context("failed to persist allowlist to config.toml")?;
                }
            }
            other => anyhow::bail!("allowlist persist unsupported for channel '{other}'"),
        }
        tracing::debug!("{LOG_PREFIX} persisted allowed identity for channel={channel}");
        Ok(())
    }
}

// ---------------------------------------------------------------------------
// EventSink → routes provider events to the right OpenHuman bus

View on GitHub (pinned to 7491200858)

Solutions

  1. Add a `[channels.telegram]` section to `~/.openhuman/config.toml` (at minimum with the bot token) and retry the authorization message.
  2. Configure Telegram through the app's Connections/Settings UI first, so the section is created before any user pairs.
  3. If you maintain the adapter, create the section on demand in this arm instead of bailing.

Example fix

# before — ~/.openhuman/config.toml has no telegram section; pairing fails

# after
[channels.telegram]
token = "123456:ABC-your-bot-token"
allowed_users = []
Defensive patterns

Strategy: validation

Validate before calling

// Before enabling the Telegram pairing flow, verify the config section exists
let config_path = home.join(".openhuman").join("config.toml");
let raw = std::fs::read_to_string(&config_path).unwrap_or_default();
if !raw.lines().any(|l| l.trim() == "[channels.telegram]") {
    // create the section (via the app's Connections UI or by writing minimal TOML)
    // before the first user authorization arrives
}

Try / catch

match store.persist_allowed_identity("telegram", identity).await {
    Err(e) if e.to_string().contains("telegram channel config is missing") => {
        // create [channels.telegram] in config.toml, then have the user re-send the
        // authorization message — the retry succeeds and appends allowed_users
    }
    other => other?,
}

Prevention

When it happens

Trigger: A Telegram user completes first-time authorization/pairing while `~/.openhuman/config.toml` contains no `[channels.telegram]` block — e.g. the bot token was configured only via environment variable on a fresh install, or the section was removed by hand-editing or a partial config regeneration.

Common situations: Fresh installs where TELEGRAM_BOT_TOKEN was set via env only; hand-trimmed config files; configs regenerated by migrations; headless/docker setups that never opened the Telegram settings UI.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/c895737ab85d2b7f. Report an issue: GitHub.