{"record":{"id":"219b2a1333eb3ede","repo":"can1357/oh-my-pi","slug":"memory-glob-patterns-require-the-memory-namespac","errorCode":null,"errorMessage":"Memory glob patterns require the ${MEMORY_NAMESPACE} namespace: ${input}","messagePattern":"Memory glob patterns require the (.+?) namespace: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/internal-urls/memory-protocol.ts","lineNumber":80,"sourceCode":"}\n\n/**\n * Split a memory:// glob at its first wildcard after validating the complete\n * decoded path. The suffix is validated before filesystem globbing so `..`\n * cannot escape a safely resolved base directory.\n */\nexport function splitMemoryGlobPattern(input: string): MemoryGlobPattern {\n\tconst urlMatch = input.match(/^([a-z][a-z0-9+.-]*:\\/\\/[^/?#]*)(\\/.*)?$/i);\n\tif (!urlMatch) {\n\t\tthrow new Error(`Invalid memory glob URL: ${input}`);\n\t}\n\n\t// Parse only the scheme and authority. A literal `?` in the path is glob\n\t// syntax, not a query delimiter, and must survive unchanged.\n\tconst url = parseInternalUrl(urlMatch[1]);\n\tconst namespace = url.rawHost || url.hostname;\n\tif (url.protocol !== \"memory:\" || namespace !== MEMORY_NAMESPACE) {\n\t\tthrow new Error(`Memory glob patterns require the ${MEMORY_NAMESPACE} namespace: ${input}`);\n\t}\n\n\tconst rawPathname = urlMatch[2] ?? \"\";\n\tif (/%(?:2f|5c)/i.test(rawPathname)) {\n\t\tthrow new Error(`Encoded path separators are not allowed in memory:// glob patterns: ${input}`);\n\t}\n\n\tlet relativePath: string;\n\ttry {\n\t\trelativePath = decodeURIComponent(rawPathname.replace(/^\\//, \"\"));\n\t} catch {\n\t\tthrow new Error(`Invalid URL encoding in memory:// path: ${input}`);\n\t}\n\n\ttry {\n\t\tvalidateRelativePath(relativePath);\n\t} catch (error) {\n\t\tthrow toMemoryValidationError(error);","sourceCodeStart":62,"sourceCodeEnd":98,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/internal-urls/memory-protocol.ts#L62-L98","documentation":"Glob patterns are only supported against the file-backed 'root' namespace (memory://root/...). After parsing the authority, splitMemoryGlobPattern rejects any URL whose scheme isn't memory: or whose host/namespace isn't 'root'. Other namespaces (e.g. mnemopi memory ids) are single memories and cannot be globbed.","triggerScenarios":"Calling splitMemoryGlobPattern with skill://root/..., memory://<memory-id>/..., or any non-memory scheme carrying a wildcard path.","commonSituations":"Copy-pasting a skill:// URL into a memory glob; trying to wildcard over mnemopi memory ids; a script templating the wrong scheme prefix.","solutions":["Use the memory:// scheme with the root namespace: memory://root/<glob-path>.","For non-root namespaces, address a single memory id directly (memory://<id>) instead of globbing.","Fix templating/config that substitutes the wrong scheme (skill:// vs memory://)."],"exampleFix":"// before\nsplitMemoryGlobPattern(\"skill://root/notes/*.md\");\n// after\nsplitMemoryGlobPattern(\"memory://root/notes/*.md\");","handlingStrategy":"validation","validationCode":"function isRootNamespaceMemoryGlob(input: string): boolean {\n  return /^memory:\\/\\/root(\\/|$)/i.test(input);\n}\n// only call splitMemoryGlobPattern when isRootNamespaceMemoryGlob(input)","typeGuard":"function isMemoryUrl(input: string): boolean {\n  try {\n    return new URL(input).protocol === \"memory:\";\n  } catch {\n    return false;\n  }\n}","tryCatchPattern":"try {\n  return splitMemoryGlobPattern(input);\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"require the root namespace\")) {\n    throw new Error(`${input} is not globbable; address a single memory://root/... path or a single memory://<id>`);\n  }\n  throw e;\n}","preventionTips":["Glob only within memory://root — other namespaces address single memories.","Fix templates that substitute skill:// or other schemes into memory glob slots.","Validate scheme+namespace before invoking glob APIs."],"tags":["memory","namespace","validation"],"backgroundTag":"invalid-namespace","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}