{"record":{"id":"3f512db4c6b0b149","repo":"mastra-ai/mastra","slug":"skill-with-id-id-not-found","errorCode":null,"errorMessage":"Skill with id ${id} not found","messagePattern":"Skill with id (.+?) not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/skills/inmemory.ts","lineNumber":98,"sourceCode":"        changedFields: Object.keys(snapshotConfig),\n        changeMessage: 'Initial version',\n      });\n    } catch (error) {\n      // Roll back the orphaned skill record\n      this.db.skills.delete(skill.id);\n      throw error;\n    }\n\n    // Return the thin record\n    return this.deepCopyConfig(newConfig);\n  }\n\n  async update(input: StorageUpdateSkillInput): Promise<StorageSkillType> {\n    const { id, ...updates } = input;\n\n    const existingConfig = this.db.skills.get(id);\n    if (!existingConfig) {\n      throw new Error(`Skill with id ${id} not found`);\n    }\n\n    // Separate metadata fields from config fields\n    const { authorId, visibility, activeVersionId, status, ...rawConfigFields } = updates;\n\n    // Filter out undefined keys: callers may spread partial snapshots into\n    // update() and rely on \"omit = no change\" semantics. Without this, an\n    // undefined value would clobber the latest version's populated field\n    // when spread into newConfig below.\n    const configFields: Record<string, unknown> = {};\n    for (const [key, value] of Object.entries(rawConfigFields)) {\n      if (value !== undefined) configFields[key] = value;\n    }\n\n    // Config field names from StorageSkillSnapshotType\n    const configFieldNames = [\n      'name',\n      'description',","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/skills/inmemory.ts#L80-L116","documentation":"In-memory skills storage update() looks up the skill by id in its map and throws when it is absent. Like create, update targets an existing record only — there is no upsert semantics.","triggerScenarios":"Calling update({ id, ... }) for an id never created in this store instance; updating on a fresh/restarted process where the in-memory data is gone; a typo'd or cross-environment id.","commonSituations":"In-memory store reset between dev-server restarts while the client still holds old ids; test isolation issues where setup didn't create the skill; id mismatch after data re-seed with new ids.","solutions":["Create the skill before updating, or switch to a persistent storage adapter if data must survive restarts.","Check existence via a get/has call before updating and create if missing (upsert pattern).","Verify the id against a list call; fix typos or stale ids.","Re-seed the in-memory store at startup if updates depend on seeded data."],"exampleFix":"// before\nawait skillsStorage.update({ id: 'deploy', status: 'active' }); // throws if absent\n// after\nif (!skillsDb.skills.has('deploy')) {\n  await skillsStorage.create({ skill: { id: 'deploy', ...defaults } });\n}\nawait skillsStorage.update({ id: 'deploy', status: 'active' });","handlingStrategy":"validation","validationCode":"const existing = await storage.get({ id });\nif (!existing) throw new Error(`skill ${id} not found; create before update`);","typeGuard":"async function skillExists(storage: InMemorySkillsStorage, id: string): Promise<boolean> {\n  return (await storage.get({ id })) != null;\n}","tryCatchPattern":"try {\n  return await storage.update(input);\n} catch (e) {\n  if (e instanceof Error && e.message === `Skill with id ${input.id} not found`) {\n    return storage.create({ skill: { id: input.id, ...defaults, ...input } as StorageCreateSkillInput });\n  }\n  throw e;\n}","preventionTips":["Check existence before updating, or implement upsert logic.","Remember in-memory stores reset on process restart; re-seed or use persistent storage.","Validate ids against a list call before issuing updates.","Avoid reusing ids captured from prior sessions."],"tags":["storage","not-found","skills","in-memory"],"backgroundTag":"resource-not-found","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}