{"record":{"id":"4681aa0c944152fc","repo":"ruvnet/ruflo","slug":"namespace-exceeds-128-characters","errorCode":null,"errorMessage":"namespace exceeds 128 characters","messagePattern":"namespace exceeds 128 characters","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts","lineNumber":805,"sourceCode":"    description: 'Enumerate stored memory entries (optionally filtered by namespace/tags) without semantic search. Use when native Glob is wrong because the entries are not files (they live in .swarm/memory.db). For inspection / audit / \"what is in my memory\" — pair with memory_search for retrieval-by-meaning.',\n    category: 'memory',\n    inputSchema: {\n      type: 'object',\n      properties: {\n        namespace: { type: 'string', description: 'Filter by namespace' },\n        limit: { type: 'number', description: 'Maximum results (default: 50)' },\n        offset: { type: 'number', description: 'Offset for pagination (default: 0)' },\n      },\n    },\n    handler: async (input) => {\n      await ensureInitialized();\n      const { listEntries } = await getMemoryFunctions();\n\n      const namespace = input.namespace as string | undefined;\n      const limit = (input.limit as number) || 50;\n      const offset = (input.offset as number) || 0;\n\n      if (namespace) { const vNs = validateIdentifier(namespace, 'namespace'); if (!vNs.valid) throw new Error(vNs.error); }\n\n      try {\n        const result = await listEntries({\n          namespace,\n          limit,\n          offset,\n        });\n\n        const entries = result.entries.map(e => ({\n          key: e.key,\n          namespace: e.namespace,\n          storedAt: e.createdAt,\n          updatedAt: e.updatedAt,\n          accessCount: e.accessCount,\n          hasEmbedding: e.hasEmbedding,\n          size: e.size,\n        }));\n","sourceCodeStart":787,"sourceCodeEnd":823,"githubUrl":"https://github.com/ruvnet/ruflo/blob/9c61c86f06b439af2a95085ae9bb0ca839662e41/v3/@claude-flow/cli/src/mcp-tools/memory-tools.ts#L787-L823","documentation":"validateIdentifier caps identifiers at 128 characters; memory_list throws this variant when a longer namespace string is supplied (memory-tools.ts:705). The cap is part of the shared identifier contract used by dozens of MCP tools (agent IDs, session IDs, worker IDs) to keep storage keys and shell-facing strings bounded. Notably, the write-side validateMemoryInput has no namespace length cap — you can store under a 200-character namespace but then be unable to list it by that namespace.","triggerScenarios":"memory_list with a namespace assembled from a long path, a sentence, or concatenated tags that exceeds 128 characters, e.g. 'team-alpha/experiments/2026/q2/long-descriptor-name-continued...'.","commonSituations":"Auto-generated namespaces that embed file paths or descriptions; hitting the store/list asymmetry after a migration or script change; copying a long memory key into the namespace field.","solutions":["Shorten the namespace to 128 characters or fewer, restricted to alphanumerics, _, -, ., :","Derive a compact slug or hash for machine-generated long namespaces","Move descriptive detail into keys or tags, not the namespace","If entries were already written under a long namespace, re-store them under a short one (then clean up the old entries) so list/cleanup/export work"],"exampleFix":"// before\nconst ns = `team-alpha/experiments/${fullDescription}`; // 141 chars\nawait mcp.callTool('memory_list', { namespace: ns }); // namespace exceeds 128 characters\n\n// after\nconst ns = 'team-alpha:exp-2026q2'; // compact, valid identifier\nawait mcp.callTool('memory_list', { namespace: ns });","handlingStrategy":"validation","validationCode":"const IDENTIFIER_RE = /^[a-zA-Z0-9_][a-zA-Z0-9_\\-.:]{0,127}$/;\nfunction assertListableNamespace(ns: string): void {\n  if (ns.length > 128) throw new RangeError(`namespace too long (${ns.length} > 128)`);\n  if (!IDENTIFIER_RE.test(ns)) throw new RangeError('namespace must match [A-Za-z0-9_-.:] and start alnum/_');\n}\n// assertListableNamespace(ns); await mcp.callTool('memory_list', { namespace: ns });","typeGuard":"function isListableNamespace(ns: string): boolean {\n  return /^[a-zA-Z0-9_][a-zA-Z0-9_\\-.:]{0,127}$/.test(ns);\n}","tryCatchPattern":"try {\n  await memoryList({ namespace: ns });\n} catch (e) {\n  if (e instanceof Error && e.message.includes('namespace exceeds 128 characters')) {\n    // deterministic: shorten/slug the namespace, never retry the long form\n  }\n  throw e;\n}","preventionTips":["Cap generated namespaces at well under 128 characters (e.g. 64) to leave headroom","Remember the write path has no namespace length cap — enforce the 128 limit in your own write path to keep store/list consistent","Put long descriptors in keys or tags, not namespaces","Include a namespace-format lint in CI for config-driven namespace values"],"tags":["memory","mcp","list","validation","limits","namespace"],"backgroundTag":"input-length-limit-exceeded","analyzedSha":"9c61c86f06b439af2a95085ae9bb0ca839662e41","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}