{"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":860,"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":842,"sourceCodeEnd":878,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/servers/mcp-server.ts#L842-L878","documentation":"The prime_corpus MCP tool requires a 'name' argument identifying the knowledge corpus to prime. The handler destructures name from args and throws this error when it is missing, not a string, or blank. The schema also declares required: ['name'].","triggerScenarios":"Calling prime_corpus with args lacking 'name', name = undefined/null, a non-string, or an empty/whitespace string (check: typeof name !== 'string' || name.trim() === '').","commonSituations":"Callers passing only priming options (the rest spread) and forgetting the corpus name; using 'corpus' or 'corpusName' as the key; an LLM omitting the field despite the required schema entry; name derived from an empty config value.","solutions":["Pass the corpus name: { name: 'my-corpus', ...primingOptions }","Match the exact key 'name' — not corpusName, corpus, or id","Verify the corpus exists / was created before priming by that exact name","Validate at the call site: if (!name?.trim()) throw before invoking the tool"],"exampleFix":"// before\nawait callTool('prime_corpus', { sources: ['docs/'] });\n// after\nawait callTool('prime_corpus', { name: 'project-docs', sources: ['docs/'] });","handlingStrategy":"validation","validationCode":"function canPrimeCorpus(args) {\n  return typeof args?.name === 'string' && args.name.trim().length > 0;\n}\nif (!canPrimeCorpus(args)) throw new Error('Provide the corpus name before calling prime_corpus');","typeGuard":"function hasCorpusName(args: unknown): args is { name: string } & Record<string, unknown> {\n  return typeof (args as any)?.name === 'string' && (args as any).name.trim().length > 0;\n}","tryCatchPattern":"try {\n  return await callTool('prime_corpus', { name, ...options });\n} catch (e) {\n  if (e instanceof Error && e.message === 'Missing required argument: name') {\n    console.error('prime_corpus requires a non-empty corpus name');\n    return null;\n  }\n  throw e;\n}","preventionTips":["Always pass the corpus name under the exact key 'name'","Resolve the name from config with a non-empty default check","List available corpora first if unsure of the exact name","Enable MCP client-side schema validation so required: ['name'] is caught before dispatch"],"tags":["mcp","validation","corpus","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"d8bc9755e74915e5c3b999181e10a67c889bce2a","analyzedAt":"2026-09-17T16:40:26.182Z","contentChangedAt":"2026-09-17T16:40:26.182Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}