{"record":{"id":"557e24b5818ccbaf","repo":"mastra-ai/mastra","slug":"subconscious-remind-requires-a-resourceid","errorCode":null,"errorMessage":"Subconscious remind requires a resourceId.","messagePattern":"Subconscious remind requires a resourceId\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/memory/src/processors/observational-memory/subconscious/remind.ts","lineNumber":35,"sourceCode":"Never remind about knowledge that is already visible in the current observations or recent messages — a reminder is only valuable for knowledge the agent can no longer see. Echoing back what was just said or just captured is noise.\nIf nothing is relevant, respond with exactly ${NO_REMINDER} and nothing else.\nIf knowledge is relevant, return one concise reminder that explains why it matters and includes source node or record IDs. Do not invent knowledge and do not expose knowledge outside the tools' scoped results.`;\n\n/** Own-thread records younger than this are treated as still-in-context and excluded from reminder candidates. */\nconst FRESH_OWN_RECORD_WINDOW_MS = 30 * 60 * 1000;\n\nfunction resolveScope(context: {\n  requestContext?: { get(key: string): unknown };\n  resourceId?: string;\n  threadId: string;\n}) {\n  const organizationId = context.requestContext?.get('organizationId');\n  if (typeof organizationId !== 'string' || !organizationId.trim()) {\n    throw new Error('Subconscious remind requires organizationId in the request context.');\n  }\n  const resourceId = resolveKnowledgeResourceId(context.requestContext, context.resourceId);\n  if (!resourceId) {\n    throw new Error('Subconscious remind requires a resourceId.');\n  }\n\n  return canonicalizeKnowledgeScope([`org:${organizationId}`, `resource:${resourceId}`, `thread:${context.threadId}`]);\n}\n\nconst REMINDER_QUERY_STOP_WORDS = new Set([\n  'about',\n  'after',\n  'before',\n  'current',\n  'from',\n  'have',\n  'observations',\n  'that',\n  'their',\n  'there',\n  'they',\n  'this',","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/memory/src/processors/observational-memory/subconscious/remind.ts#L17-L53","documentation":"`resolveScope` in packages/memory/src/processors/observational-memory/subconscious/remind.ts:35 derives the resource portion of the knowledge scope via `resolveKnowledgeResourceId(requestContext, context.resourceId)`. When neither the explicit `resourceId` nor any requestContext fallback yields a value, remind cannot build a scope and throws.","triggerScenarios":"Calling remind with `context.resourceId` undefined/empty AND no resource identifier resolvable from requestContext (the requestContext lacks the key `resolveKnowledgeResourceId` checks).","commonSituations":"Omitting resourceId on generate/stream/memory calls in versions where it is no longer auto-inferred; constructing the remind context manually without resourceId; tests that stub threadId but forget resourceId.","solutions":["Pass an explicit `resourceId` in the context/options for the memory operation.","Or store a resource identifier in requestContext so `resolveKnowledgeResourceId` can pick it up.","Confirm whether your version still propagates resourceId automatically; otherwise update all call sites."],"exampleFix":"// before\nawait memory.remember({ threadId: 't1', requestContext });\n// after\nawait memory.remember({ threadId: 't1', resourceId: 'user_42', requestContext });","handlingStrategy":"validation","validationCode":"const resourceId = context.resourceId ?? requestContext?.get('resourceId');\nif (!resourceId || (typeof resourceId === 'string' && !resourceId.trim())) {\n  throw new Error('resourceId is required for subconscious remind');\n}","typeGuard":"function hasResourceId(ctx) {\n  const v = ctx?.resourceId ?? ctx?.requestContext?.get('resourceId');\n  return typeof v === 'string' && v.trim().length > 0;\n}","tryCatchPattern":"try {\n  await memory.remember({ threadId, requestContext });\n} catch (e) {\n  if (e.message.includes('requires a resourceId')) {\n    return memory.remember({ threadId, resourceId: derivedResourceId, requestContext });\n  }\n  throw e;\n}","preventionTips":["Always pass resourceId explicitly on generate/stream/memory calls.","Make resourceId a required field in your internal memory-call wrapper.","Audit call sites after version upgrades for dropped resourceId propagation."],"tags":["missing-context","memory","configuration"],"backgroundTag":"missing-context-value","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}