{"record":{"id":"0c97348271332a91","repo":"can1357/oh-my-pi","slug":"unknown-protocol-memory","errorCode":null,"errorMessage":"Unknown protocol: memory://","messagePattern":"Unknown protocol: memory://","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/coding-agent/src/internal-urls/memory-protocol.ts","lineNumber":295,"sourceCode":"\t\tsize: Buffer.byteLength(content, \"utf-8\"),\n\t\tnotes: [],\n\t};\n}\n\n/**\n * Protocol handler for memory:// URLs.\n * Resolves file-backed roots against the calling session cwd when provided.\n * Contextless callers fall back to the live-session registry for legacy\n * cross-session lookups.\n */\nexport class MemoryProtocolHandler implements ProtocolHandler {\n\treadonly scheme = \"memory\";\n\treadonly immutable = true;\n\n\tasync resolve(url: InternalUrl, context?: ResolveContext): Promise<InternalResource> {\n\t\tconst backend = memoryBackendFromContext(context);\n\t\tif (backend === \"off\") {\n\t\t\tthrow new Error(\"Unknown protocol: memory://\");\n\t\t}\n\t\tconst namespace = url.rawHost || url.hostname;\n\t\tif (!namespace) {\n\t\t\tthrow new Error(\"memory:// URL requires a namespace: memory://root or memory://<memory-id>\");\n\t\t}\n\n\t\t// Mnemopi rows live in SQLite banks per session, keyed by memory id.\n\t\t// Any host other than the file-backed `root` namespace is treated as a\n\t\t// mnemopi memory id lookup. This is the read counterpart to\n\t\t// `memory_edit update` and lets agents inspect the full content of a\n\t\t// clipped recall preview before overwriting it (issue #4443).\n\t\tif (namespace !== MEMORY_NAMESPACE) {\n\t\t\tconst mnemopiStates = mnemopiSessionStatesFromRegistry();\n\t\t\tconst hindsightActive =\n\t\t\t\tbackend === \"hindsight\" ||\n\t\t\t\t(mnemopiStates.length === 0 &&\n\t\t\t\t\tAgentRegistry.global()\n\t\t\t\t\t\t.list()","sourceCodeStart":277,"sourceCodeEnd":313,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/packages/coding-agent/src/internal-urls/memory-protocol.ts#L277-L313","documentation":"MemoryProtocolHandler.resolve first checks the configured memory.backend. If it is set to 'off', memory support is disabled entirely, so the handler reports the memory:// scheme itself as unknown — the same error a URL router would give for an unregistered protocol. This is intentional: with memories off, no memory:// URL can resolve.","triggerScenarios":"Resolving any memory:// URL while context.settings.get('memory.backend') === 'off' — i.e. memories explicitly disabled in settings — reaches this branch before any namespace parsing.","commonSituations":"User disabled memory in omp settings but an agent prompt or recall tool description still references memory:// URLs; a plugin or extension hard-coding memory:// reads in an environment where the backend was turned off.","solutions":["Re-enable memory support by setting memory.backend to a supported value (e.g. 'file' or 'mnemopi') in settings.","If memory should stay off, stop issuing memory:// reads — gate the caller/agent tool on memory being enabled.","Check that the ResolveContext carries the right settings object; a wrong context can surface an unintended 'off' backend."],"exampleFix":"// settings.json — before\n{ \"memory\": { \"backend\": \"off\" } }\n// after\n{ \"memory\": { \"backend\": \"file\" } }","handlingStrategy":"validation","validationCode":"const backend = settings.get(\"memory.backend\");\nif (backend === \"off\") throw new Error(\"memory:// reads require an enabled memory backend\");","typeGuard":null,"tryCatchPattern":"try {\n  return await handler.resolve(url, ctx);\n} catch (err) {\n  if (err instanceof Error && err.message === \"Unknown protocol: memory://\") {\n    // memory disabled — skip or prompt user to enable memory.backend\n  } else throw err;\n}","preventionTips":["Check memory.backend in settings before advertising memory:// to agents/tools.","Gate memory-dependent prompts and tool descriptions on memory being enabled.","Avoid hard-coding memory:// reads in plugins that may run with memories off."],"tags":["configuration","memory-protocol","disabled-feature"],"backgroundTag":"feature-disabled-in-config","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}