mem0ai/mem0 · error · NodeOperationError

Invalid JSON in "Custom Categories" field

Error message

Invalid JSON in "Custom Categories" field

What it means

A 400 raised by _validate_bundled_providers when config['embedder']['provider'] is set to an embedder not included in BUNDLED_EMBEDDER_PROVIDERS for this server image. Same packaging rationale as the LLM variant: the image bundles only a fixed set of embedding provider packages, and an unbundleable provider is rejected before it can produce a runtime ImportError deep inside a memory operation.

Source

Thrown at integrations/n8n-nodes-mem0/nodes/Mem0/Mem0.node.ts:443

						} catch {
							throw new NodeOperationError(this.getNode(), 'Invalid JSON in "Metadata" field', {
								itemIndex: i,
							});
						}
					}

					// Custom extraction controls (optional): steer what the API extracts.
					if (addFields.custom_instructions) {
						body.custom_instructions = addFields.custom_instructions;
					}
					if (addFields.custom_categories) {
						try {
							body.custom_categories =
								typeof addFields.custom_categories === 'string'
									? JSON.parse(addFields.custom_categories as string)
									: addFields.custom_categories;
						} catch {
							throw new NodeOperationError(
								this.getNode(),
								'Invalid JSON in "Custom Categories" field',
								{ itemIndex: i },
							);
						}
					}

					if (addFields.includes) body.includes = addFields.includes;
					if (addFields.excludes) body.excludes = addFields.excludes;

					// API requires at least one entity id — fail clearly instead of a raw 4xx.
					if (!body.user_id && !body.agent_id && !body.run_id && !body.app_id) {
						throw new NodeOperationError(
							this.getNode(),
							'Add requires at least one of User ID, Agent ID, Run ID, or App ID',
							{ itemIndex: i },
						);
					}

View on GitHub (pinned to 001c235229)

Solutions

  1. Use an embedder from the bundled list shown in the error message (commonly 'openai').
  2. Build a custom image installing the embedder's package and extend BUNDLED_EMBEDDER_PROVIDERS in server/main.py.
  3. Or run from source with the needed extras installed.
  4. Double-check the provider string against mem0's supported embedder names.

Example fix

# before
{"embedder": {"provider": "huggingface", "config": {"model": "BAAI/bge-small-en-v1.5"}}}

# after
{"embedder": {"provider": "openai", "config": {"model": "text-embedding-3-small"}}}
Defensive patterns

Strategy: validation

Validate before calling

BUNDLED_EMBEDDER_PROVIDERS = {"openai"}  # mirror the image's list

def validate_embedder_config(cfg: dict) -> None:
    emb = cfg.get("embedder") or {}
    provider = emb.get("provider", "openai")
    if provider not in BUNDLED_EMBEDDER_PROVIDERS:
        raise ValueError(f"Embedder '{provider}' not bundled; pick from {sorted(BUNDLED_EMBEDDER_PROVIDERS)}")

Type guard

def is_bundled_embedder(provider: str, bundled: set[str]) -> bool:
    return provider in bundled

Try / catch

if resp.status_code == 400 and "not bundled" in resp.text:
    raise ConfigError(resp.json()["detail"])  # fix config or image; retrying unchanged will fail again

Prevention

When it happens

Trigger: Submitting a config with "embedder": {"provider": "huggingface"} when the image only bundles e.g. openai; changing embedding providers on an existing deployment without rebuilding the image; typos in the provider field.

Common situations: Switching from OpenAI embeddings to a local/HuggingFace embedder in the containerized server; following a docs example whose provider isn't in the shipped image; image version older than the provider you want.

Understand the failure class

Related errors


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