{"record":{"id":"e6eeb20073e1540b","repo":"thedotmack/claude-mem","slug":"missing-required-argument-name","errorCode":null,"errorMessage":"Missing required argument: name","messagePattern":"Missing required argument: name","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/servers/mcp-server.ts","lineNumber":828,"sourceCode":"    },\n    handler: async (args: any) => {\n      return await callWorker('/api/corpus', { query: args });\n    }\n  },\n  {\n    name: 'prime_corpus',\n    description: 'Prime a knowledge corpus — creates an AI session loaded with the corpus knowledge. Must be called before query_corpus.',\n    inputSchema: {\n      type: 'object',\n      properties: {\n        name: { type: 'string', description: 'Name of the corpus to prime' }\n      },\n      required: ['name'],\n      additionalProperties: true\n    },\n    handler: async (args: any) => {\n      const { name, ...rest } = args;\n      if (typeof name !== 'string' || name.trim() === '') throw new Error('Missing required argument: name');\n      return await callWorker(`/api/corpus/${encodeURIComponent(name)}/prime`, { body: rest });\n    }\n  },\n  {\n    name: 'query_corpus',\n    description: 'Ask a question to a primed knowledge corpus. The corpus must be primed first with prime_corpus.',\n    inputSchema: {\n      type: 'object',\n      properties: {\n        name: { type: 'string', description: 'Name of the corpus to query' },\n        question: { type: 'string', description: 'The question to ask' }\n      },\n      required: ['name', 'question'],\n      additionalProperties: true\n    },\n    handler: async (args: any) => {\n      const { name, ...rest } = args;\n      if (typeof name !== 'string' || name.trim() === '') throw new Error('Missing required argument: name');","sourceCodeStart":810,"sourceCodeEnd":846,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/servers/mcp-server.ts#L810-L846","documentation":"Validation error in the prime_corpus tool handler. After destructuring args, the handler checks typeof name !== 'string' || name.trim() === '' and throws this plain Error. It fires before the POST /api/corpus/<name>/prime call is made to the worker.","triggerScenarios":"Calling prime_corpus with name omitted, non-string, or whitespace-only. The MCP schema lists name as required but additionalProperties is true, so malformed calls can still reach the handler.","commonSituations":"LLM client passes { question: '...' } but forgets name; name read from a config that was empty; caller confused prime (needs name only) with query (needs name + question).","solutions":["Pass a non-empty name string identifying an existing or new corpus.","Confirm the corpus exists (or that prime is allowed to create it) before calling query_corpus.","Validate name is a non-empty string on the caller side."],"exampleFix":"// before\nawait tools.prime_corpus({});\n// throws 'Missing required argument: name'\n\n// after\nawait tools.prime_corpus({ name: 'auth-docs' });","handlingStrategy":"validation","validationCode":"if (typeof args?.name !== 'string' || args.name.trim() === '') {\n  return { content: [{ type: 'text', text: 'prime_corpus: name is required' }], isError: true };\n}","typeGuard":"function hasCorpusName(v: unknown): v is { name: string } {\n  return typeof (v as any)?.name === 'string' && (v as any).name.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Always pass a non-empty corpus name; prime_corpus does not infer a default.","Validate name client-side before invoking.","Prime must precede query — track primed corpora in client state."],"tags":["mcp","validation","corpus"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}