{"record":{"id":"b595321b0705656b","repo":"ruvnet/ruflo","slug":"memory-path-is-required","errorCode":null,"errorMessage":"memory path is required","messagePattern":"memory path is required","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/mcp-tools/agenticow-loader.ts","lineNumber":71,"sourceCode":"  }\n}\n\n/** Reset the module-level load cache. Test-only seam. */\nexport function __resetAgenticowCache(): void {\n  _agenticowMod = null;\n  _loadAttempted = false;\n}\n\nexport function degradedResult(reason: string): { success: true; degraded: true; reason: string } {\n  return { success: true, degraded: true, reason };\n}\n\n/**\n * Resolve a user-supplied memory path against the project cwd, rejecting path\n * traversal and NUL bytes (D-2 style hardening — same rule the MCP verbs use).\n */\nexport function resolveMemoryPath(path: string): string {\n  if (!path || typeof path !== 'string') throw new Error('memory path is required');\n  if (/\\.\\.[\\\\/]|\\0/.test(path)) throw new Error('memory path contains disallowed characters');\n  return isAbsolute(path) ? path : resolve(getProjectCwd(), path);\n}\n\n/**\n * Lineage manifest companion path. agenticow persists the COW chain\n * (working → checkpoints → base) into `<file>.agenticow.json` next to the\n * `.rvf` data file. Without it, forks/checkpoints are in-memory only and\n * disappear when the AgenticMemory handle closes.\n */\nexport function manifestFor(file: string): string {\n  return `${file}.agenticow.json`;\n}\n\n/** Validate a COW branch/checkpoint label (alnum + a small safe symbol set). */\nexport function validateLabel(label: string): string {\n  if (!label || typeof label !== 'string') throw new Error('label is required');\n  if (label.length > 256) throw new Error('label exceeds 256 chars');","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/ruvnet/ruflo/blob/fa13ee4ad60ac2090b1480656eb233521790d640/v3/@claude-flow/cli/src/mcp-tools/agenticow-loader.ts#L53-L89","documentation":"Thrown by resolveMemoryPath() in the agenticow MCP tool loader (agenticow-loader.ts:71), the shared entry guard for every agenticow_* tool that touches a memory file (agenticow_branch, agenticow_ingest, agenticow_query, agenticow_diff, agenticow_lineage, agenticow_checkpoint, agenticow_rollback, agenticow_promote, agenticow_speculate). It fires before any path resolution when the user-supplied path is falsy (undefined, null, empty string) or not a string. This prevents the tools from silently operating on an unintended or garbage location.","triggerScenarios":"Calling any agenticow_* tool with path (or basePath for agenticow_speculate) set to an empty string, or calling resolveMemoryPath() programmatically with undefined/null. Note the MCP handlers wrap the value with String(), so a fully omitted path becomes the string 'undefined' and slips past this check — the empty string '' is what triggers it.","commonSituations":"Form or UI defaults that submit path:''; an optional variable that was never assigned before the tool call; a parameter-name typo — most tools take 'path' but agenticow_speculate takes 'basePath'; spreading an options object that lacks the key.","solutions":["Pass a non-empty relative path (resolved against the project cwd, e.g. 'memory/main.rvf') or an absolute path","Use the correct parameter name: 'path' for most agenticow_* tools, 'basePath' for agenticow_speculate","Check the value for ''/undefined immediately before the tool call and fail with your own clearer message"],"exampleFix":"// before\nawait callTool('agenticow_query', { path: '', vector: [0.1, 0.2] });\n// throws: memory path is required\n\n// after\nawait callTool('agenticow_query', { path: 'memory/main.rvf', vector: [0.1, 0.2] });","handlingStrategy":"validation","validationCode":"function assertMemoryPath(p: unknown): string {\n  if (typeof p !== 'string' || p.trim() === '') {\n    throw new TypeError('agenticow: path/basePath must be a non-empty string');\n  }\n  return p;\n}\n// run before the tool call\nassertMemoryPath(args.path ?? args.basePath);","typeGuard":"const isNonEmptyString = (v: unknown): v is string => typeof v === 'string' && v.trim().length > 0;","tryCatchPattern":"try {\n  await callTool('agenticow_query', args);\n} catch (e) {\n  if (e instanceof Error && e.message === 'memory path is required') {\n    return { error: 'bad_request', detail: 'path must be a non-empty relative or absolute path' };\n  }\n  throw e;\n}","preventionTips":["Make path a required field in your own client schema so the call cannot be built without it","Remember the parameter split: 'path' for most agenticow_* tools, 'basePath' for agenticow_speculate","Default to a convention like 'memory/<project>.rvf' so scripts never send an empty path"],"tags":["validation","mcp","memory","required-parameter","agenticow"],"backgroundTag":"missing-required-argument","analyzedSha":"fa13ee4ad60ac2090b1480656eb233521790d640","analyzedAt":"2026-08-18T21:34:22.708Z","contentChangedAt":"2026-08-18T21:34:22.708Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}