zeroclaw-labs/zeroclaw · error

Tavily API key not configured (decrypted value is empty)

Error message

Tavily API key not configured (decrypted value is empty)

What it means

Provider configuration guard in reload_tavily_api_key: the configured Tavily key decrypts to an empty string, so the Tavily provider cannot authenticate. Misconfiguration of the encrypted secret, not a transient failure.

Solutions

  1. Set the Tavily API key: `zeroclaw config set tools.web_search.tavily.api_key <key>` or re-run `zeroclaw quickstart`.
  2. Check that the stored encrypted key decrypts to a non-empty value and re-enter it if necessary.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at crates/zeroclaw-tools/src/web_search_tool.rs:368 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23). Data as JSON: /api/errors/3ff85865d6fa88d0. Report an issue: GitHub.

Appendix: source

Thrown at crates/zeroclaw-tools/src/web_search_tool.rs:368

            .filter(|k| !k.is_empty())
            .ok_or_else(|| {
                ::zeroclaw_log::record!(
                    ERROR,
                    ::zeroclaw_log::Event::new(module_path!(), ::zeroclaw_log::Action::Reject)
                        .with_outcome(::zeroclaw_log::EventOutcome::Failure)
                        .with_attrs(::serde_json::json!({"search_provider": "tavily"})),
                    "web_search: Tavily API key not configured"
                );
                anyhow::Error::msg("Tavily API key not configured")
            })?;

        if zeroclaw_config::secrets::SecretStore::is_encrypted(&raw_key) {
            let zeroclaw_dir = self.config_path.parent().unwrap_or_else(|| Path::new("."));
            let store =
                zeroclaw_config::secrets::SecretStore::new(zeroclaw_dir, self.secrets_encrypt);
            let plaintext = store.decrypt(&raw_key)?;
            if plaintext.is_empty() {
                anyhow::bail!("Tavily API key not configured (decrypted value is empty)");
            }
            Ok(plaintext)
        } else {
            Ok(raw_key)
        }
    }

    async fn search_tavily(&self, query: &str) -> anyhow::Result<String> {
        let client = self.build_tavily_client()?;
        self.search_tavily_with_client(&client, "https://api.tavily.com/search", query)
            .await
    }

    fn build_tavily_client(&self) -> anyhow::Result<reqwest::Client> {
        let builder = reqwest::Client::builder().timeout(Duration::from_secs(self.timeout_secs));
        let builder =
            zeroclaw_config::schema::apply_runtime_proxy_to_builder(builder, "tool.web_search");
        Ok(builder.build()?)

View on GitHub (pinned to 88bb9c8533)