thedotmack/claude-mem · error
Missing required argument: name
Error message
Missing required argument: name
What it means
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.
Source
Thrown at src/servers/mcp-server.ts:828
},
handler: async (args: any) => {
return await callWorker('/api/corpus', { query: args });
}
},
{
name: 'prime_corpus',
description: 'Prime a knowledge corpus — creates an AI session loaded with the corpus knowledge. Must be called before query_corpus.',
inputSchema: {
type: 'object',
properties: {
name: { type: 'string', description: 'Name of the corpus to prime' }
},
required: ['name'],
additionalProperties: true
},
handler: async (args: any) => {
const { name, ...rest } = args;
if (typeof name !== 'string' || name.trim() === '') throw new Error('Missing required argument: name');
return await callWorker(`/api/corpus/${encodeURIComponent(name)}/prime`, { body: rest });
}
},
{
name: 'query_corpus',
description: 'Ask a question to a primed knowledge corpus. The corpus must be primed first with prime_corpus.',
inputSchema: {
type: 'object',
properties: {
name: { type: 'string', description: 'Name of the corpus to query' },
question: { type: 'string', description: 'The question to ask' }
},
required: ['name', 'question'],
additionalProperties: true
},
handler: async (args: any) => {
const { name, ...rest } = args;
if (typeof name !== 'string' || name.trim() === '') throw new Error('Missing required argument: name');View on GitHub (pinned to d768ba3643)
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.
Example fix
// before
await tools.prime_corpus({});
// throws 'Missing required argument: name'
// after
await tools.prime_corpus({ name: 'auth-docs' }); Defensive patterns
Strategy: validation
Validate before calling
if (typeof args?.name !== 'string' || args.name.trim() === '') {
return { content: [{ type: 'text', text: 'prime_corpus: name is required' }], isError: true };
} Type guard
function hasCorpusName(v: unknown): v is { name: string } {
return typeof (v as any)?.name === 'string' && (v as any).name.trim().length > 0;
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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).
Related errors
- "${key}" is required
- Unknown tool: ${name}
- observation_add: "content" is required
- observation_record_event: "eventType" is required
- observation_search: "query" is required
AI-assisted analysis of thedotmack/claude-mem@d768ba3643 (2026-08-12).
Data as JSON: /api/errors/e6eeb20073e1540b.
Report an issue: GitHub.