{"record":{"id":"055609fc8b318771","repo":"thedotmack/claude-mem","slug":"observation-generation-status-jobid-is-required","errorCode":null,"errorMessage":"observation_generation_status: \"jobId\" is required","messagePattern":"observation_generation_status: \"jobId\" is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/servers/mcp-server.ts","lineNumber":402,"sourceCode":"    };\n  }\n\n  return callWorker('/api/context/inject', {\n    query: {\n      projects: projects.join(','),\n      ...(args.platformSource !== undefined ? { platformSource: normalizeMcpPlatformSource(args.platformSource) } : {}),\n      ...(args.full !== undefined ? { full: args.full } : {}),\n      ...(args.colors !== undefined ? { colors: args.colors } : {}),\n    },\n    text: true,\n  });\n}\n\nconst handleObservationGenerationStatus = wrapHandler('observation_generation_status', async (args: ObservationGenerationStatusArgs) => {\n  const ctx = requireServerForObservationTool('observation_generation_status');\n  const jobId = (args?.jobId ?? args?.job_id ?? '').trim();\n  if (!jobId) {\n    throw new Error('observation_generation_status: \"jobId\" is required');\n  }\n  const response = await ctx.client.getJobStatus(jobId);\n  return formatJsonResult(response);\n});\n\nasync function ensureWorkerConnection(): Promise<boolean> {\n  if (await verifyWorkerConnection()) {\n    return true;\n  }\n\n  logger.warn('SYSTEM', 'Worker not available, attempting auto-start for MCP client');\n\n  errorIfWorkerScriptMissing();\n\n  try {\n    const port = getWorkerPort();\n    const result = await ensureWorkerStarted(port, WORKER_SCRIPT_PATH);\n    if (result === 'dead') {","sourceCodeStart":384,"sourceCodeEnd":420,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d768ba364302d12b76e69e4f021f0bb1d2d50ed6/src/servers/mcp-server.ts#L384-L420","documentation":"Validation error inside the observation_generation_status tool handler. After the server-runtime guard passes, the handler normalizes jobId from args.jobId or args.job_id (snake-case alias), trims it, and throws this plain Error if the result is empty. This fires before ServerClient.getJobStatus() is called.","triggerScenarios":"Calling observation_generation_status with both jobId and job_id omitted/blank, or with a non-string that coerces to empty after trim. The handler accepts either camelCase or snake_case but both must be absent to fail.","commonSituations":"Caller lost the job id returned by a prior record_event with generate=true; passed an object id field that was undefined; copy-paste from a payload that used a different key name (e.g. 'id', 'generationJobId').","solutions":["Pass the job id returned by the generating call, using either jobId or job_id.","If you have no job id, the generation either wasn't started (call recordEvent with generate !== false) or already completed; check the event response first.","Store the returned job id immediately when you trigger generation so you can poll status."],"exampleFix":"// before\nawait tools.observation_generation_status({});\n// throws 'observation_generation_status: \"jobId\" is required'\n\n// after\nconst { generationJob } = await tools.observation_record_event({\n  eventType: 'session.end', generate: true,\n});\nawait tools.observation_generation_status({ jobId: generationJob.id });","handlingStrategy":"validation","validationCode":"const jobId = (args?.jobId ?? args?.job_id ?? '').toString().trim();\nif (!jobId) {\n  return { content: [{ type: 'text', text: 'jobId is required for observation_generation_status' }], isError: true };\n}","typeGuard":"function hasJobId(v: unknown): v is { jobId: string } | { job_id: string } {\n  const j = (v as any)?.jobId ?? (v as any)?.job_id;\n  return typeof j === 'string' && j.trim().length > 0;\n}","tryCatchPattern":null,"preventionTips":["Store the job id returned by recordEvent(generate=true) immediately so it is available for polling.","Accept both jobId and job_id at the client boundary to match the handler's normalization.","Skip the status call when no generation was started rather than passing an empty id."],"tags":["mcp","validation","observation-tools","jobs"],"backgroundTag":null,"analyzedSha":"d768ba364302d12b76e69e4f021f0bb1d2d50ed6","analyzedAt":"2026-08-12T23:52:55.241Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}