{"record":{"id":"ee611acd965421c6","repo":"mastra-ai/mastra","slug":"no-versions-found-for-skill-id","errorCode":null,"errorMessage":"No versions found for skill ${id}","messagePattern":"No versions found for skill (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/core/src/storage/domains/skills/filesystem.ts","lineNumber":127,"sourceCode":"    const updatedEntity: StorageSkillType = {\n      ...existing,\n      ...(authorId !== undefined && { authorId }),\n      ...(visibility !== undefined && { visibility }),\n      ...(activeVersionId !== undefined && { activeVersionId }),\n      ...(status !== undefined && { status: status as StorageSkillType['status'] }),\n      updatedAt: new Date(),\n    };\n\n    // Auto-set status to 'published' when activeVersionId is set without explicit status\n    if (activeVersionId !== undefined && status === undefined) {\n      updatedEntity.status = 'published';\n    }\n\n    // If config fields are being updated, create a new version\n    if (hasConfigUpdate) {\n      const latestVersion = await this.getLatestVersion(id);\n      if (!latestVersion) {\n        throw new Error(`No versions found for skill ${id}`);\n      }\n\n      const {\n        id: _versionId,\n        skillId: _skillId,\n        versionNumber: _versionNumber,\n        changedFields: _changedFields,\n        changeMessage: _changeMessage,\n        createdAt: _createdAt,\n        ...latestConfig\n      } = latestVersion;\n\n      const newConfig = {\n        ...latestConfig,\n        ...configFields,\n      };\n\n      const changedFields = configFieldNames.filter(","sourceCodeStart":109,"sourceCodeEnd":145,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/core/src/storage/domains/skills/filesystem.ts#L109-L145","documentation":"When FilesystemSkillsStorage.update detects a config-field change, it creates a new version derived from the latest existing version. If the skill exists but has no versions at all (corrupt or partially-written state), there is no base to copy from, so it throws this error.","triggerScenarios":"Calling update with any config field set on a skill whose version directory on disk is empty or missing — e.g. the skill record was created manually without an initial version, files were deleted externally, or a partial write/crash left no versions.","commonSituations":"Hand-editing or cleaning the storage directory; interrupted writes leaving skill metadata without versions; importing skills metadata without version files.","solutions":["Recreate the skill (delete and re-create) so an initial version is written.","Manually restore/repair the missing version file(s) in the storage directory.","Update only metadata fields (authorId, visibility, activeVersionId, status) instead of config fields until a version exists.","Check disk health/write process for the partial-write that dropped the versions."],"exampleFix":"// before\nawait storage.update({ id: 'my-skill', instructions: 'new' }); // throws: no versions\n// after\nawait storage.create({ skill: { id: 'my-skill', instructions: 'new', ...rest } }); // fresh skill+version","handlingStrategy":"validation","validationCode":"const latest = await storage.getLatestVersion(id);\nif (!latest) throw new Error(`skill ${id} has no version history; recreate it`);","typeGuard":"async function hasVersionHistory(storage: FilesystemSkillsStorage, id: string): Promise<boolean> {\n  return (await storage.getLatestVersion(id)) != null;\n}","tryCatchPattern":"try {\n  return await storage.update(input);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith('No versions found for skill')) {\n    logger.error(`skill ${id} has corrupt/missing version history; recreate required`);\n    return null;\n  }\n  throw e;\n}","preventionTips":["Always create skills through the storage API so an initial version is written.","Do not hand-edit or prune the storage version directories.","Only update metadata fields on skills you suspect lack versions.","Monitor/repair partial writes after crashes or disk issues."],"tags":["storage","filesystem","corrupt-state","skills","versions"],"backgroundTag":"missing-version-history","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}