affaan-m/ECC · error
has too many values (maximum ).
Error message
${label} has too many values (maximum ${limit}). What it means
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.
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.
Example fix
// before
normalizeMemory({ tags: allTags /* 45 items */, ... })
// after
normalizeMemory({ tags: allTags.slice(0, 32), ... }) Defensive patterns
Strategy: validation
Validate before calling
const LIMITS = { tags: 32, links: 64, targets: 32 };
if (tags.length > LIMITS.tags) tags = tags.slice(0, LIMITS.tags); Type guard
null
Try / catch
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; } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.
Related errors
- is too long (maximum characters).
- must be a lowercase letters/numbers slug.
- must be a non-empty string.
- must be an array.
- must be an ISO-8601 timestamp.
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/0e909c1e88680507.
Report an issue: GitHub.
Appendix: 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 8321021c54)