zeroclaw-labs/zeroclaw · error
microsoft365.tenant_id must not be empty when microsoft365 i
Error message
microsoft365.tenant_id must not be empty when microsoft365 is enabled
What it means
Enabling [microsoft365] (enabled = true) requires tenant_id to be present, trimmed, and non-empty. The value is trimmed then filtered before the check, so omitted, empty, and whitespace-only all fail. Note this is the first of two adjacent identical M365 validation blocks in Config::validate() (schema.rs:21685 and 21728) — this quoted-message variant is the one users actually hit because it runs first. Only non-emptiness is checked; the value should be the Entra ID (Azure AD) directory tenant ID.
Source
Thrown at crates/zeroclaw-config/src/schema.rs:21693
if is_official_ollama_cloud_endpoint(entry.uri.as_deref())
&& !has_ollama_cloud_credential(entry.api_key.as_deref())
{
anyhow::bail!(
"providers.models.ollama.{alias}.model uses ':cloud', but no API key is configured. Set api_key on [providers.models.ollama.{alias}] (or via the schema-mirror grammar: ZEROCLAW_providers__models__ollama__{alias}__api_key=<value>)."
);
}
}
// Microsoft 365
if self.microsoft365.enabled {
let tenant = self
.microsoft365
.tenant_id
.as_deref()
.map(str::trim)
.filter(|s| !s.is_empty());
if tenant.is_none() {
anyhow::bail!(
"microsoft365.tenant_id must not be empty when microsoft365 is enabled"
);
}
let client = self
.microsoft365
.client_id
.as_deref()
.map(str::trim)
.filter(|s| !s.is_empty());
if client.is_none() {
anyhow::bail!(
"microsoft365.client_id must not be empty when microsoft365 is enabled"
);
}
let flow = self.microsoft365.auth_flow.trim();
if flow != "client_credentials" && flow != "device_code" {
anyhow::bail!(
"microsoft365.auth_flow must be 'client_credentials' or 'device_code'"View on GitHub (pinned to 88bb9c8533)
Solutions
- Set microsoft365.tenant_id to the Entra tenant (directory) ID GUID from the Azure portal (Microsoft Entra ID > Overview > Tenant ID)
- Trim accidental whitespace and stray quotes when pasting
- If not ready to integrate, set microsoft365.enabled = false
- After tenant_id passes, client_id and auth_flow checks follow immediately — fix them in the same edit
Example fix
# before [microsoft365] enabled = true # tenant_id missing # after [microsoft365] enabled = true tenant_id = "11111111-2222-3333-4444-555555555555"
Defensive patterns
Strategy: validation
Validate before calling
fn m365_precheck(m: &zeroclaw_config::Microsoft365Config) -> Result<(), String> {
if !m.enabled { return Ok(()); }
if m.tenant_id.as_deref().map(str::trim).is_none_or(str::is_empty) {
return Err("microsoft365.tenant_id must not be empty when microsoft365 is enabled".into());
}
Ok(())
} Type guard
fn m365_tenant_ready(m: &zeroclaw_config::Microsoft365Config) -> bool {
!m.enabled || m.tenant_id.as_deref().map(str::trim).is_some_and(|s| !s.is_empty())
} Try / catch
if let Err(err) = config.validate() {
if err.to_string().contains("microsoft365.tenant_id") {
// fill tenant_id (Entra Tenant ID GUID) or set enabled = false, then reload
}
} Prevention
- Gate [microsoft365] enabled on having all four credentials available (tenant, client, flow, secret)
- Pull Entra IDs from your secret store at template time, with an empty-value assertion
- Keep the integration disabled in base configs; enable per-environment
When it happens
Trigger: Set `microsoft365.enabled = true` with tenant_id omitted, set to "", or containing only whitespace.
Common situations: Enabling the integration before the Azure app registration exists; secret-manager lookups returning empty strings; pasting the tenant display name into the wrong field and leaving tenant_id blank.
Related errors
- microsoft365.client_id must not be empty when microsoft365 i
- microsoft365.auth_flow must be 'client_credentials' or 'devi
- microsoft365.client_secret must not be empty when auth_flow
- microsoft365.auth_flow must be client_credentials or device_
- microsoft365.client_secret must not be empty when auth_flow
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/af3f7f83aac9a879.
Report an issue: GitHub.