bytedance/deer-flow · error

Failed to load agents: ${res.statusText}

Error message

Failed to load agents: ${res.statusText}

What it means

Raised by Mem0Config validation when base_url uses an http:// scheme while allow_insecure_http is false. The mem0 backend sends the API key as a credential on every request to base_url, so plaintext HTTP would leak it on the wire; the config therefore demands https:// unless the operator explicitly opts into insecure transport.

Source

Thrown at frontend/src/core/agents/api.ts:41

    super(message);
    this.name = "AgentNameCheckError";
  }
}

export class AgentsApiDisabledError extends Error {
  constructor(message: string) {
    super(message);
    this.name = "AgentsApiDisabledError";
  }
}

function isAgentsApiDisabledDetail(detail: string | undefined): boolean {
  return typeof detail === "string" && detail.includes("agents_api.enabled");
}

export async function listAgents(): Promise<Agent[]> {
  const res = await fetch(`${getBackendBaseURL()}/api/agents`);
  if (!res.ok) throw new Error(`Failed to load agents: ${res.statusText}`);
  const data = (await res.json()) as { agents: Agent[] };
  return data.agents;
}

export async function getAgent(name: string): Promise<Agent> {
  const res = await fetch(`${getBackendBaseURL()}/api/agents/${name}`);
  if (!res.ok) throw new Error(`Agent '${name}' not found`);
  return res.json() as Promise<Agent>;
}

export async function createAgent(request: CreateAgentRequest): Promise<Agent> {
  const res = await fetch(`${getBackendBaseURL()}/api/agents`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify(request),
  });
  if (!res.ok) {
    const err = (await res.json().catch(() => ({}))) as { detail?: string };

View on GitHub (pinned to 1dd6ba1acb)

Solutions

  1. Change base_url to an https:// URL (terminate TLS at the service or a reverse proxy).
  2. If the endpoint is trusted local/internal infrastructure, set allow_insecure_http: true in the mem0 backend_config and keep the deployment off public networks.
  3. Check for a scheme typo, e.g. base_url: http://api.mem0.ai should be https://api.mem0.ai.

Example fix

# before
memory:
  backend: mem0
  backend_config:
    base_url: http://mem0.internal:8080

# after (option 1: TLS)
    base_url: https://mem0.internal:8443
# after (option 2: explicit opt-in, trusted network only)
    base_url: http://mem0.internal:8080
    allow_insecure_http: true
Defensive patterns

Strategy: validation

Validate before calling

from urllib.parse import urlsplit


def check_mem0_base_url(base_url: str, allow_insecure_http: bool) -> None:
    p = urlsplit(base_url)
    assert p.scheme in {'http', 'https'} and p.netloc, 'need absolute http(s) URL'
    assert p.scheme == 'https' or allow_insecure_http, (
        'http:// base_url requires allow_insecure_http: true (trusted local only)'
    )

Prevention

When it happens

Trigger: Setting the mem0 memory backend's base_url to an http:// URL (e.g. a local or self-hosted instance at http://10.0.0.5:8080) in config.yaml without also setting allow_insecure_http: true. Any startup or config reload that constructs the mem0 backend from that config fails immediately in the validate hook.

Common situations: Pointing at a local mem0 container or an internal endpoint with no TLS certificate; copying a docker-compose example URL with http:// into production config; running behind a TLS-terminating proxy and mistakenly giving the backend the plain upstream address.

Related errors


AI-assisted analysis of bytedance/deer-flow@1dd6ba1acb (2026-08-14). Data as JSON: /api/errors/c2f5134a51394410. Report an issue: GitHub.