{"record":{"id":"fe31d581d33a4f36","repo":"mastra-ai/mastra","slug":"claudesdkagent-resumedata-must-include-either-sess","errorCode":null,"errorMessage":"ClaudeSDKAgent resumeData must include either sessionId or continue: true, not both.","messagePattern":"ClaudeSDKAgent resumeData must include either sessionId or continue: true, not both\\.","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"agent-sdks/claude/src/index.ts","lineNumber":246,"sourceCode":"  async resumeStream<OUTPUT = undefined>(\n    resumeData: ClaudeSDKAgentResumeData,\n    options?: ClaudeSDKAgentRunOptions<OUTPUT>,\n  ): Promise<MastraModelOutput<OUTPUT>> {\n    const data = validateClaudeResumeData(resumeData);\n    return this.stream(data.message, createClaudeResumeRunOptions(data, options));\n  }\n}\n\nfunction validateClaudeResumeData(resumeData: ClaudeSDKAgentResumeData): ClaudeSDKAgentResumeData {\n  if (!isRecord(resumeData) || !('message' in resumeData)) {\n    throw new Error('ClaudeSDKAgent resumeData must include a message.');\n  }\n\n  const hasSessionId = 'sessionId' in resumeData;\n  const hasContinue = 'continue' in resumeData;\n\n  if (hasSessionId && hasContinue) {\n    throw new Error('ClaudeSDKAgent resumeData must include either sessionId or continue: true, not both.');\n  }\n\n  if (hasSessionId) {\n    if (typeof resumeData.sessionId !== 'string') {\n      throw new Error('ClaudeSDKAgent resumeData.sessionId must be a string.');\n    }\n    return resumeData;\n  }\n\n  if (hasContinue) {\n    if (resumeData.continue !== true) {\n      throw new Error('ClaudeSDKAgent resumeData.continue must be true when provided.');\n    }\n    return resumeData;\n  }\n\n  throw new Error('ClaudeSDKAgent resumeData must include sessionId or continue: true.');\n}","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/agent-sdks/claude/src/index.ts#L228-L264","documentation":"The restore handler verifies the agent exists via agentsStore.getById before restoring; a null result produces this 404. The restore target agent must exist in storage.","triggerScenarios":"POST restore on /api/agents/:agentId/versions/:versionId where :agentId is not present in the agents store.","commonSituations":"Deleting an agent then replaying old client requests; wrong environment/database; misspelled or stale agentId in the client.","solutions":["Confirm the agentId via GET /api/agents before restoring","Correct the path parameter","Point the server at the storage environment containing the agent","Recreate the agent record if it was deleted"],"exampleFix":"// before\nawait fetch(`/api/agents/${staleAgentId}/versions/${vId}/restore`, { method: 'POST' });\n// after\nconst exists = (await fetch('/api/agents').then(r => r.json())).some(a => a.id === staleAgentId);\nif (exists) await fetch(`/api/agents/${staleAgentId}/versions/${vId}/restore`, { method: 'POST' });","handlingStrategy":"validation","validationCode":"const agents = await fetch('/api/agents').then(r => r.json());\nif (!agents.some(a => a.id === agentId)) throw new Error(`Cannot restore: agent ${agentId} missing`);","typeGuard":"function canRestore(agents: {id: string}[], agentId: string): boolean {\n  return agents.some(a => a.id === agentId);\n}","tryCatchPattern":"try {\n  await fetch(`/api/agents/${agentId}/versions/${versionId}/restore`, { method: 'POST' });\n} catch (e) {\n  if (isHttpError(e) && e.status === 404 && e.message.includes('Agent with id')) {\n    // recreate agent or fix agentId before retrying\n  } else throw e;\n}","preventionTips":["Check agent existence before restore calls","Guard cleanup jobs from deleting agents with active version references","Use ids sourced from the same environment as the target storage","Confirm DB connection env vars match the intended environment"],"tags":["http-404","not-found","agents","rest-api"],"backgroundTag":"resource-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}