affaan-m/ECC · error · Error

${label} has too many values (maximum ${limit}).

Error message

${label} has too many values (maximum ${limit}).

What it means

Thrown by uniqueStrings() when the array length exceeds the per-field limit (e.g. MAX_TAGS=32, MAX_LINKS=64, MAX_TARGETS=32). The limit is the second guard after the type check and prevents runaway documents.

Source

Thrown at scripts/lib/memory-vault-format.js:120

    throw new Error(`${label} must be a lowercase letters/numbers slug.`);
  }
  return normalized;
}

function validateMemoryId(value) {
  const normalized = asNonEmptyString(value, 'memory id', 132);
  if (!MEMORY_ID_PATTERN.test(normalized)) {
    throw new Error('memory id must match mem_<lowercase-id> and cannot contain a path.');
  }
  return normalized;
}

function uniqueStrings(values, { label, limit, validator }) {
  if (!Array.isArray(values)) {
    throw new Error(`${label} must be an array.`);
  }
  if (values.length > limit) {
    throw new Error(`${label} has too many values (maximum ${limit}).`);
  }
  return values.reduce((result, value) => {
    const normalized = validator(value);
    if (result.includes(normalized)) {
      throw new Error(`${label} must not contain duplicate values.`);
    }
    return [...result, normalized];
  }, []);
}

function validateTimestamp(value, label) {
  const normalized = asNonEmptyString(value, label, 64);
  const parsed = new Date(normalized);
  if (
    !ISO_TIMESTAMP_PATTERN.test(normalized)
    || Number.isNaN(parsed.getTime())
    || parsed.toISOString() !== normalized
  ) {

View on GitHub (pinned to 01e15490f0)

Solutions

  1. Reduce the list to within the documented limit (the number is in the error message).
  2. Dedupe and prioritize the most relevant entries.
  3. Split the memory into multiple documents if all entries are genuinely needed.

Example fix

// before
uniqueStrings(tags.slice(), { label: 'tags', limit: 32, validator: v => v }); // tags.length === 50
// after
uniqueStrings(dedupeAndRank(tags).slice(0, 32), { label: 'tags', limit: 32, validator: v => v });
Defensive patterns

Strategy: validation

Validate before calling

function enforceLimit(values, limit) {
  if (values.length > limit) {
    throw new Error(`List exceeds limit of ${limit}; got ${values.length}.`);
  }
  return values;
}

Type guard

function isWithinLimit(values, limit) {
  return Array.isArray(values) && values.length <= limit;
}

Try / catch

try {
  result = uniqueStrings(values, opts);
} catch (e) {
  if (/has too many values/.test(e.message)) result = uniqueStrings(values.slice(0, opts.limit), opts);
  else throw e;
}

Prevention

When it happens

Trigger: Submitting 33 tags, 65 links, or 33 target harnesses in a single memory document.

Common situations: Auto-generated tag lists that explode combinatorially; merging documents without dedup; bulk imports.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/0e909c1e88680507. Report an issue: GitHub.