ruvnet/ruflo · error · Error

Value exceeds maximum size of ${MAX_VALUE_SIZE} bytes

Error message

Value exceeds maximum size of ${MAX_VALUE_SIZE} bytes

What it means

Thrown by validateMemoryInput when a memory value exceeds 1 MB (MAX_VALUE_SIZE = 1024*1024). The memory backend persists values to JSON/SQLite; unbounded values would blow up the store and serialisation. The check is a strict length comparison on the value string.

Source

Thrown at v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts:76

}

// D-2: Input bounds for memory parameters
const MAX_KEY_LENGTH = 1024;
const MAX_VALUE_SIZE = 1024 * 1024; // 1MB
const MAX_QUERY_LENGTH = 4096;

// #1425 — single source of truth for the dangerous-character set rejected by
// validateMemoryInput. Imported by sanitizeMemoryKey so write-side sanitization
// and read-side rejection can never drift apart (the symmetry bug behind #1884).
const DANGEROUS_KEY_CHARS = /[;&|`$(){}[\]<>!#\\\0]|\.\.[/\\]/g;
const DANGEROUS_KEY_PATTERN = /[;&|`$(){}[\]<>!#\\\0]|\.\.[/\\]/;

function validateMemoryInput(key?: string, value?: string, query?: string, namespace?: string): void {
  if (key && key.length > MAX_KEY_LENGTH) {
    throw new Error(`Key exceeds maximum length of ${MAX_KEY_LENGTH} characters`);
  }
  if (value && value.length > MAX_VALUE_SIZE) {
    throw new Error(`Value exceeds maximum size of ${MAX_VALUE_SIZE} bytes`);
  }
  if (query && query.length > MAX_QUERY_LENGTH) {
    throw new Error(`Query exceeds maximum length of ${MAX_QUERY_LENGTH} characters`);
  }
  // Reject path traversal and shell metacharacters in keys/namespaces (#1425)
  if (key && DANGEROUS_KEY_PATTERN.test(key)) {
    throw new Error('Key contains disallowed characters');
  }
  if (namespace && DANGEROUS_KEY_PATTERN.test(namespace)) {
    throw new Error('Namespace contains disallowed characters');
  }
}

// #1884 — sanitize a key produced from arbitrary input (markdown headings,
// frontmatter names, file names) so it survives validateMemoryInput on the
// read/delete path. Replaces every dangerous char with `_`. Truncates to
// MAX_KEY_LENGTH so the bound check in validateMemoryInput also passes.
// Keep this in sync with DANGEROUS_KEY_PATTERN — they share DANGEROUS_KEY_CHARS.

View on GitHub (pinned to 6b01dc5a68)

Solutions

  1. Chunk large payloads into multiple keyed entries (e.g. doc-1, doc-2).
  2. Store large blobs externally (filesystem, object storage) and keep only a reference in memory.
  3. Compress or summarise the value before storing.
  4. Pre-check value.length <= 1048576 before calling memory store.

Example fix

// before
memory store --key "log" --value "$(cat huge.log)"
// after
// store a reference instead
memory store --key "log" --value "{\"path\":\"/data/logs/huge.log\"}"
Defensive patterns

Strategy: validation

Validate before calling

const MAX_VALUE_SIZE = 1024 * 1024;
function assertValueSize(value) {
  if (typeof value === 'string' && value.length > MAX_VALUE_SIZE) {
    throw new Error(`value is ${value.length} bytes; max ${MAX_VALUE_SIZE}. Chunk or externalise.`);
  }
}

Prevention

When it happens

Trigger: Calling memory store with a value string longer than 1,048,576 characters/bytes. Common with large logs, full file contents, or serialised embeddings.

Common situations: Storing an entire log file or stack trace; serialising a large object/array; pasting a base64-encoded binary; an LLM context dump; embedding vectors stored as verbose JSON.

Related errors


AI-assisted analysis of ruvnet/ruflo@6b01dc5a68 (2026-08-12). Data as JSON: /api/errors/e26ea06d29cce2d5. Report an issue: GitHub.