{"record":{"id":"2bc1eb1cecc06a63","repo":"mastra-ai/mastra","slug":"processor-processor-id-computestatesignal-cou","errorCode":null,"errorMessage":"[Processor:${processor.id}] computeStateSignal could not load thread ${resolvedThreadId}","messagePattern":"\\[Processor:(.+?)\\] computeStateSignal could not load thread (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/processors/runner.ts","lineNumber":405,"sourceCode":"    if (!resolvedMemory) {\n      throw new Error(\n        `[Processor:${processor.id}] computeStateSignal requires Mastra memory with an active resourceId and threadId`,\n      );\n    }\n\n    // Memory is configured but this invocation has no thread/resource identity\n    // (e.g. an ephemeral workflow agent step). State signals are thread-scoped,\n    // so skip rather than throw.\n    if (!resolvedThreadId || !resolvedResourceId) {\n      this.logger.debug(\n        `[Processor:${processor.id}] computeStateSignal skipped — no threadId/resourceId resolved for this invocation`,\n      );\n      return;\n    }\n\n    const loadedThread = (await resolvedMemory.getThreadById({ threadId: resolvedThreadId })) ?? memoryContext?.thread;\n    if (!loadedThread) {\n      throw new Error(`[Processor:${processor.id}] computeStateSignal could not load thread ${resolvedThreadId}`);\n    }\n    let 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\n    const stateId = processor.stateId ?? processor.id;\n    const beforeAddStateSignal = rotateResponseMessageId;\n    const trackingById = getStateSignalsMetadata(thread.metadata);\n    const tracking = trackingById[stateId];\n    const { activeStateSignals, contextWindow, lastSnapshot, deltasSinceSnapshot } = await resolveStateSignalHistory({\n      messageList,\n      memory: resolvedMemory,\n      threadId: resolvedThreadId,","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/processors/runner.ts#L387-L423","documentation":"After memory is resolved, runComputeStateSignal loads the thread via memory.getThreadById({ threadId }) (falling back to the thread embedded in the request context). If neither exists, the thread-scoped state signal cannot proceed and the runner throws naming the processor and missing threadId.","triggerScenarios":"runComputeStateSignal is called with a resolvedThreadId that does not exist in the memory store: stale/expired thread ID, wrong storage backend, thread deleted between calls, or a threadId string that was never created via memory.createThread.","commonSituations":"Pointing at a thread ID from a different environment (dev vs prod storage); switching storage adapters without migrating threads; typos/hardcoded thread IDs; storage cleared (in-memory storage restarted).","solutions":["Create the thread first via memory.createThread({ threadId, resourceId }) before running processors that emit state signals.","Verify the thread exists: await memory.getThreadById({ threadId }) — if null, use a valid thread ID.","Check that the memory storage backend is the one where the thread was created (same DB/connection).","Pass the loaded thread object in the request context so the memoryContext?.thread fallback applies."],"exampleFix":"// before\nawait run(input, { memory: { thread: 'ghost-thread', resource: 'u1' } }); // never created\n// after\nawait memory.createThread({ threadId: 'ghost-thread', resourceId: 'u1' });\nawait run(input, { memory: { thread: 'ghost-thread', resource: 'u1' } });","handlingStrategy":"validation","validationCode":"const thread = await memory.getThreadById({ threadId });\nif (!thread) {\n  await memory.createThread({ threadId, resourceId });\n}","typeGuard":null,"tryCatchPattern":"try {\n  await run(input, { memory: { thread: threadId, resource: resourceId } });\n} catch (e) {\n  if (e?.message?.includes('could not load thread')) {\n    await memory.createThread({ threadId, resourceId });\n    // retry once\n  } else throw e;\n}","preventionTips":["Create threads before referencing them.","Verify storage backend matches the environment that created the thread.","Don't hardcode thread IDs; resolve them from your session store."],"tags":["processors","memory","thread","persistence"],"backgroundTag":"thread-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}