{"record":{"id":"44121ee735754c60","repo":"mastra-ai/mastra","slug":"processor-processor-id-sendstatesignal-requir","errorCode":null,"errorMessage":"[Processor:${processor.id}] sendStateSignal requires Mastra memory with an active resourceId and threadId","messagePattern":"\\[Processor:(.+?)\\] sendStateSignal requires Mastra memory with an active resourceId and threadId","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/processors/runner.ts","lineNumber":1587,"sourceCode":"          ...inputData,\n          state: processorState.customState,\n          abort,\n          ...(rotateResponseMessageId ? { rotateResponseMessageId } : {}),\n          ...createObservabilityContext({ currentSpan: processorSpan }),\n          retryCount: args.retryCount ?? 0,\n          writer,\n          abortSignal: args.abortSignal,\n          agent: this.agent,\n          sendSignal: createProcessorSendSignal({ messageList, writer, rotateResponseMessageId }),\n          sendStateSignal: async (\n            stateSignal: AgentStateSignalInput | (Omit<AgentStateSignalInput, 'id'> & { id?: string }),\n          ) => {\n            const memoryContext = parseMemoryRequestContext(requestContext);\n            const resolvedMemory = args.memory;\n            const resolvedThreadId = args.threadId ?? memoryContext?.thread?.id;\n            const resolvedResourceId = args.resourceId ?? memoryContext?.resourceId;\n            if (!resolvedMemory || !resolvedThreadId || !resolvedResourceId) {\n              throw new Error(\n                `[Processor:${processor.id}] sendStateSignal requires Mastra memory with an active resourceId and threadId`,\n              );\n            }\n            const loadedThread =\n              (await resolvedMemory.getThreadById({ threadId: resolvedThreadId })) ?? memoryContext?.thread;\n            if (!loadedThread) {\n              throw new Error(`[Processor:${processor.id}] sendStateSignal could not load thread ${resolvedThreadId}`);\n            }\n            const thread = {\n              ...loadedThread,\n              id: resolvedThreadId,\n              resourceId: loadedThread.resourceId ?? resolvedResourceId,\n              createdAt: loadedThread.createdAt ?? new Date(),\n              updatedAt: loadedThread.updatedAt ?? new Date(),\n              metadata: loadedThread.metadata,\n            };\n            const result = await applyStateSignal({\n              input: stateSignal,","sourceCodeStart":1569,"sourceCodeEnd":1605,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/processors/runner.ts#L1569-L1605","documentation":"A processor called the sendStateSignal() helper during processing, but the runner could not resolve all of: a Mastra memory instance, a resourceId, and a threadId (from args or the memory request context). sendStateSignal persists processor state into a memory thread, so all three are mandatory; a plain Error naming the processor is thrown.","triggerScenarios":"A processor invokes sendStateSignal() in an agent configured without memory, or with memory but no threadId/resourceId supplied and no memory request context present.","commonSituations":"Using stateful processors in stateless/agent-as-tool setups; forgetting to pass threadId/resourceId to agent.generate; running agents without memory configured while a processor assumes it.","solutions":["Configure memory on the agent (new Memory({ storage })) and pass threadId + resourceId in the generate/stream call.","Ensure the memory request context is available if relying on it for thread resolution.","Remove or gate the sendStateSignal call in the processor when memory isn't guaranteed (check availability first)."],"exampleFix":"// before\nawait agent.generate('hi'); // processor calls sendStateSignal -> throws\n// after\nawait agent.generate('hi', {\n  memory: { thread: 'thread-123', resource: 'user-42' },\n});","handlingStrategy":"validation","validationCode":"function assertMemoryReady(args: { memory?: unknown; threadId?: string; resourceId?: string }) {\n  if (!args.memory || !args.threadId || !args.resourceId)\n    throw new Error('sendStateSignal processors require memory + threadId + resourceId in the agent call');\n}\n// call before agent.generate/stream\nassertMemoryReady({ memory: agentMemory, threadId: 't-1', resourceId: 'u-1' });","typeGuard":"function hasMemoryContext(a: { memory?: unknown; threadId?: string; resourceId?: string }):\n  a is { memory: NonNullable<typeof a.memory>; threadId: string; resourceId: string } {\n  return !!a.memory && typeof a.threadId === 'string' && typeof a.resourceId === 'string';\n}","tryCatchPattern":"try {\n  await agent.generate(input, { memory: { thread, resource } });\n} catch (e) {\n  if (e instanceof Error && e.message.includes('sendStateSignal requires Mastra memory')) {\n    console.error('Pass memory/threadId/resourceId to the agent call or disable stateful processors');\n  } else throw e;\n}","preventionTips":["Always pass memory.thread and memory.resource when using stateful processors","Configure Memory on the agent before adding state-signal processors","Gate sendStateSignal behind an availability check inside the processor","Document that stateful processors require persistent threads"],"tags":["agent","processors","memory","configuration"],"backgroundTag":"missing-memory-thread-context","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}