mem0ai/mem0 · error · Error

openclaw-mem0 config required

Error message

openclaw-mem0 config required

What it means

Thrown by mem0ConfigSchema.parse when the plugin config value passed to register() is missing, null, a primitive, or an array — parse requires a plain object to validate keys against. Note the plugin's config must at least be an object ({} is fine); the gateway resolves ${VAR} substitution before calling parse, so this is a structural failure, not a missing-variable failure.

Source

Thrown at integrations/openclaw/config.ts:178

  "topK",
  "oss",
  "skills",
];

function assertAllowedKeys(
  value: Record<string, unknown>,
  allowed: string[],
  label: string,
) {
  const unknown = Object.keys(value).filter((key) => !allowed.includes(key));
  if (unknown.length === 0) return;
  throw new Error(`${label} has unknown keys: ${unknown.join(", ")}`);
}

export const mem0ConfigSchema = {
  parse(value: unknown, fileConfig?: FileConfig): Mem0Config {
    if (!value || typeof value !== "object" || Array.isArray(value)) {
      throw new Error("openclaw-mem0 config required");
    }
    const cfg = value as Record<string, unknown>;
    assertAllowedKeys(cfg, ALLOWED_KEYS, "openclaw-mem0 config");

    // Only two modes: "platform" (default) or "open-source"
    if (
      typeof cfg.mode === "string" &&
      cfg.mode !== "platform" &&
      cfg.mode !== "open-source"
    ) {
      console.warn(
        `[mem0] Unknown mode "${cfg.mode}" — expected "platform" or "open-source". Defaulting to "platform".`,
      );
    }
    const mode: Mem0Mode =
      cfg.mode === "open-source" ? "open-source" : "platform";

    // Resolve API key: pluginConfig → fileConfig fallback (from openclaw.json plugin section)

View on GitHub (pinned to 001c235229)

Solutions

  1. Ensure the plugins['openclaw-mem0'] section in openclaw.json exists and is a JSON object — even {} passes.
  2. If hosting the plugin yourself, pass an object (not JSON string) to register/parse; JSON.parse first if you hold a string.
  3. After editing, re-run a config command to confirm parsing succeeds before starting the gateway.

Example fix

// before
register({ pluginConfig: JSON.stringify(cfg) }); // string fails

// after
register({ pluginConfig: cfg }); // plain object
Defensive patterns

Strategy: type-guard

Type guard

function isPluginConfig(v: unknown): v is Record<string, unknown> {
  return typeof v === 'object' && v !== null && !Array.isArray(v);
}

Try / catch

try {
  mem0ConfigSchema.parse(pluginConfig);
} catch (err) {
  if ((err as Error).message === 'openclaw-mem0 config required') {
    // host passed wrong shape: ensure plugins['openclaw-mem0'] is a JSON object
  }
  throw err;
}

Prevention

When it happens

Trigger: Registering the plugin with pluginConfig = null/undefined/'platform'/[]; a gateway or host that passes the raw JSON file content when it is an array; test harnesses calling parse(0) or parse('string').

Common situations: Host integration (OpenClaw gateway) miswired and passing the wrong slice of openclaw.json; plugin loaded with an empty plugins section that evaluates to undefined; version mismatch between gateway contract and plugin expectations.

Related errors


AI-assisted analysis of mem0ai/mem0@001c235229 (2026-08-15). Data as JSON: /api/errors/df9881cf4a6f457f. Report an issue: GitHub.