{"record":{"id":"0e909c1e88680507","repo":"affaan-m/ECC","slug":"label-has-too-many-values-maximum-limit","errorCode":null,"errorMessage":"${label} has too many values (maximum ${limit}).","messagePattern":"(.+?) has too many values \\(maximum (.+?)\\)\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/memory-vault-format.js","lineNumber":120,"sourceCode":"    throw new Error(`${label} must be a lowercase letters/numbers slug.`);\n  }\n  return normalized;\n}\n\nfunction validateMemoryId(value) {\n  const normalized = asNonEmptyString(value, 'memory id', 132);\n  if (!MEMORY_ID_PATTERN.test(normalized)) {\n    throw new Error('memory id must match mem_<lowercase-id> and cannot contain a path.');\n  }\n  return normalized;\n}\n\nfunction uniqueStrings(values, { label, limit, validator }) {\n  if (!Array.isArray(values)) {\n    throw new Error(`${label} must be an array.`);\n  }\n  if (values.length > limit) {\n    throw new Error(`${label} has too many values (maximum ${limit}).`);\n  }\n  return values.reduce((result, value) => {\n    const normalized = validator(value);\n    if (result.includes(normalized)) {\n      throw new Error(`${label} must not contain duplicate values.`);\n    }\n    return [...result, normalized];\n  }, []);\n}\n\nfunction validateTimestamp(value, label) {\n  const normalized = asNonEmptyString(value, label, 64);\n  const parsed = new Date(normalized);\n  if (\n    !ISO_TIMESTAMP_PATTERN.test(normalized)\n    || Number.isNaN(parsed.getTime())\n    || parsed.toISOString() !== normalized\n  ) {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/memory-vault-format.js#L102-L138","documentation":"uniqueStrings enforces a per-field maximum number of entries (limit, e.g. MAX_TAGS=32, MAX_LINKS=64, MAX_TARGETS=32) and throws when the array has more values. This caps document size and prevents unbounded growth of memory vault files.","triggerScenarios":"Passing an array with more than the configured limit to targetHarnesses, normalizeMemory (tags/links), normalizeScopes, or kinds — e.g. 33 tags when the maximum is 32.","commonSituations":"Bulk-importing memories with hundreds of tags accumulated over time; an automated script appending a tag on every run without deduplication; copying link lists from a much larger document; increasing collections without pruning old entries.","solutions":["Trim the array to the limit before calling, keeping the most relevant entries first.","Deduplicate the array beforehand (a duplicate check runs later, but reducing count may get you under the limit).","Split the content into multiple memory documents, each within the per-field limits.","Check which limit applies (tags: 32, links: 64, targets: 32) using the label in the error message."],"exampleFix":"// before\nnormalizeMemory({ tags: allTags /* 45 items */, ... })\n// after\nnormalizeMemory({ tags: allTags.slice(0, 32), ... })","handlingStrategy":"validation","validationCode":"const LIMITS = { tags: 32, links: 64, targets: 32 };\nif (tags.length > LIMITS.tags) tags = tags.slice(0, LIMITS.tags);","typeGuard":"null","tryCatchPattern":"try { normalizeMemory(mem); } catch (e) { const m = e.message.match(/maximum (\\d+)/); if (m) mem.tags = mem.tags.slice(0, Number(m[1])); else throw e; }","preventionTips":["Deduplicate and prune lists before every save","Split oversized content into multiple linked memories","Alert when a list approaches its limit (e.g. >80% full)","Never append unconditionally to persisted tag/link lists"],"tags":["validation","limit","memory-vault"],"backgroundTag":"value-out-of-range","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}