mastra-ai/mastra · error · Error

[Processor:${processor.id}] computeStateSignal requires Mast

Error message

[Processor:${processor.id}] computeStateSignal requires Mastra memory with an active resourceId and threadId

What it means

runComputeStateSignal lets a processor emit state signals (abort/compute) that are thread-scoped via Mastra memory. If no memory instance is available in the invocation (resolvedMemory is undefined), the processor cannot scope state, so the runner throws. The message names the three requirements: Mastra memory, resourceId, threadId.

Source

Thrown at packages/core/src/processors/runner.ts:388

    abort: (reason?: string, options?: TripWireOptions) => never;
    processorState: ProcessorState;
    memory?: MastraMemory;
    resourceId?: string;
    threadId?: string;
    abortSignal?: AbortSignal;
    retryCount: number;
    rotateResponseMessageId?: () => string;
  }): Promise<void> {
    const computeStateSignal = processor.computeStateSignal?.bind(processor);
    if (!computeStateSignal) return;

    const memoryContext = parseMemoryRequestContext(requestContext);
    const resolvedMemory = memory;
    const resolvedThreadId = threadId ?? memoryContext?.thread?.id;
    const resolvedResourceId = resourceId ?? memoryContext?.resourceId;

    if (!resolvedMemory) {
      throw new Error(
        `[Processor:${processor.id}] computeStateSignal requires Mastra memory with an active resourceId and threadId`,
      );
    }

    // Memory is configured but this invocation has no thread/resource identity
    // (e.g. an ephemeral workflow agent step). State signals are thread-scoped,
    // so skip rather than throw.
    if (!resolvedThreadId || !resolvedResourceId) {
      this.logger.debug(
        `[Processor:${processor.id}] computeStateSignal skipped — no threadId/resourceId resolved for this invocation`,
      );
      return;
    }

    const loadedThread = (await resolvedMemory.getThreadById({ threadId: resolvedThreadId })) ?? memoryContext?.thread;
    if (!loadedThread) {
      throw new Error(`[Processor:${processor.id}] computeStateSignal could not load thread ${resolvedThreadId}`);
    }

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Configure memory on the agent (or pass memory in run options) so state signals have storage to work with.
  2. Supply threadId and resourceId in the request context or run options when invoking the workflow.
  3. Remove the computeStateSignal processor from workflows that are intentionally ephemeral/stateless.
  4. Upgrade @mastra/core if you expect memory from requestContext to be picked up but it is not.

Example fix

// before
mastra.getWorkflow('wf').execute({ inputData }); // no memory/thread
// after
await agent.stream('input', { memory: { thread: 'thread-1', resource: 'user-1' } });
Defensive patterns

Strategy: validation

Validate before calling

function assertStateSignalContext({ memory, threadId, resourceId }) {
  if (!memory) throw new Error('computeStateSignal processors require a memory instance');
  if (!threadId || !resourceId) throw new Error('computeStateSignal requires threadId and resourceId');
}

Try / catch

try {
  await run(input, options);
} catch (e) {
  if (e?.message?.includes('computeStateSignal requires Mastra memory')) {
    // re-run with memory + thread/resource identifiers, or drop the processor
  } else throw e;
}

Prevention

When it happens

Trigger: A processor registered in __stateSignalProcessors runs through runWorkflowComputeStateSignals or runProcessInputStep in a context where no memory was passed and parseMemoryRequestContext(requestContext) yields nothing — e.g. ephemeral workflow agent steps with no thread/resource identity.

Common situations: Using a computeStateSignal-capable processor in a workflow without configuring agent memory; running processors in a stateless API route without threadId/resourceId in the request context; forgetting to pass memory to the agent/processor run options.

Related errors


AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30). Data as JSON: /api/errors/917e7a3ed9c7153d. Report an issue: GitHub.