{"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":407,"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":389,"sourceCodeEnd":425,"githubUrl":"https://github.com/thedotmack/claude-mem/blob/d8bc9755e74915e5c3b999181e10a67c889bce2a/src/servers/mcp-server.ts#L389-L425","documentation":"The observation_generation_status handler extracts jobId from args.jobId or the snake_case alias args.job_id, trims it, and throws this error when both are absent or blank. A job ID is required to poll generation status via ctx.client.getJobStatus(jobId).","triggerScenarios":"Calling observation_generation_status with neither jobId nor job_id, or with a whitespace-only value; passing a non-string (e.g. number) whose trim yields garbage handled upstream; responding to a generation workflow without capturing the job ID returned earlier.","commonSituations":"Losing the jobId returned by an earlier observation-generation start call; callers using camelCase jobID or id instead of the two supported names; agents polling status before starting a job; template args where the placeholder was never filled.","solutions":["Pass the jobId string returned by the generation-start call: { jobId: '<job-id>' }","If your code uses snake_case, job_id is also accepted: { job_id: '<job-id>' }","Capture and persist the jobId from the start-generation response so it survives across turns","Check for typos like jobID or id — only jobId and job_id are read"],"exampleFix":"// before\nawait callTool('observation_generation_status', {});\n// after\nawait callTool('observation_generation_status', { jobId: 'gen_01h9xk2m' });","handlingStrategy":"validation","validationCode":"function canPollStatus(args) {\n  const id = (args?.jobId ?? args?.job_id ?? '').trim();\n  return id.length > 0;\n}\nif (!canPollStatus(args)) throw new Error('jobId must be captured from the generation-start response first');","typeGuard":"function hasJobId(args: unknown): args is { jobId: string } & Record<string, unknown> {\n  const v = (args as any)?.jobId ?? (args as any)?.job_id;\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  return await callTool('observation_generation_status', { jobId });\n} catch (e) {\n  if (e instanceof Error && e.message.includes('\"jobId\" is required')) {\n    console.error('No jobId available — start a generation job first and store its id');\n    return { status: 'no-job' };\n  }\n  throw e;\n}","preventionTips":["Always capture the jobId returned by the start-generation call","Persist jobId in session/agent state so it survives across turns","Only use jobId or job_id as the argument name","Never poll generation status without a prior successful start call"],"tags":["mcp","validation","job-status","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"}