{"record":{"id":"909a8f95dfddefe9","repo":"mastra-ai/mastra","slug":"memory-is-not-configured-on-this-agentcontroller-909a8f","errorCode":null,"errorMessage":"Memory is not configured on this AgentController","messagePattern":"Memory is not configured on this AgentController","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/agent-controller/session.ts","lineNumber":436,"sourceCode":"\n  /** Fetch a single thread by id, or null when it doesn't exist / no storage. */\n  async getById({ threadId }: { threadId: string }): Promise<AgentControllerThread | null> {\n    if (!this.#store) return null;\n    return this.#store.getById({ threadId });\n  }\n\n  /** Clone a detected cross-resource project thread into this session's resource. */\n  async cloneToCurrentResource({\n    threadId,\n    expectedResourceId,\n    expectedProjectPath,\n  }: {\n    threadId: string;\n    expectedResourceId: string;\n    expectedProjectPath: string;\n  }): Promise<AgentControllerThread> {\n    if (!this.#store?.hasStorage()) {\n      throw new Error('Memory is not configured on this AgentController');\n    }\n    const thread = await this.#store.getById({ threadId });\n    if (\n      !thread ||\n      thread.resourceId !== expectedResourceId ||\n      thread.metadata?.projectPath !== expectedProjectPath ||\n      expectedResourceId === this.#getResourceId()\n    ) {\n      throw new Error(`Thread not found: ${threadId}`);\n    }\n    return this.#cloneThread({\n      sourceThreadId: thread.id,\n      resourceId: this.#getResourceId(),\n      title: thread.title,\n      metadata: thread.metadata,\n    });\n  }\n","sourceCodeStart":418,"sourceCodeEnd":454,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/agent-controller/session.ts#L418-L454","documentation":"cloneToCurrentResource copies a thread into the current session's resource, which requires persistent memory/storage. The library throws this when the AgentController has no memory store configured (this.#store is undefined or reports hasStorage() === false), because the thread lookup and clone cannot be performed without storage.","triggerScenarios":"Calling cloneToCurrentResource (via promptForThreadSelection or a clonedThread flow) on an Agent constructed without memory/storage configured.","commonSituations":"Instantiating an Agent without a Memory instance or storage backend; running in a mode where storage was intentionally disabled but a clone/switch-thread UI action is still reachable.","solutions":["Configure memory with a storage backend on the Agent/AgentController (e.g. new Memory({ options: { storage } })).","Hide or disable clone/switch-thread features when storage is unavailable — gate on the store's hasStorage().","Pass the store explicitly to the AgentController if it was constructed without one."],"exampleFix":"// before\nconst agent = new Agent({ name: 'x', model });\nawait agent.controller.cloneToCurrentResource({ threadId, expectedResourceId, expectedProjectPath }); // throws\n// after\nconst agent = new Agent({ name: 'x', model, memory: new Memory({ options: { storage: new LibSQLStorage({ url }) } }) });","handlingStrategy":"validation","validationCode":"const store = getControllerStore(controller);\nif (!store || !store.hasStorage()) throw new Error('Enable memory/storage before cloning threads');","typeGuard":null,"tryCatchPattern":"try {\n  await session.cloneToCurrentResource({ threadId, expectedResourceId, expectedProjectPath });\n} catch (e) {\n  if (e instanceof Error && e.message === 'Memory is not configured on this AgentController') {\n    // disable clone UI / prompt user to configure memory\n  } else throw e;\n}","preventionTips":["Always configure Memory with a storage backend on Agents that support thread operations","Expose hasStorage() in feature flags to hide clone/switch actions","Add a startup check that storage is reachable","Don't strip memory config in ephemeral/test setups if clone features run"],"tags":["configuration","memory","storage"],"backgroundTag":"memory-not-configured","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}