mastra-ai/mastra · error

No versions found for skill ${id}

Error message

No versions found for skill ${id}

What it means

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.

Source

Thrown at packages/core/src/storage/domains/skills/filesystem.ts:127

    const updatedEntity: StorageSkillType = {
      ...existing,
      ...(authorId !== undefined && { authorId }),
      ...(visibility !== undefined && { visibility }),
      ...(activeVersionId !== undefined && { activeVersionId }),
      ...(status !== undefined && { status: status as StorageSkillType['status'] }),
      updatedAt: new Date(),
    };

    // Auto-set status to 'published' when activeVersionId is set without explicit status
    if (activeVersionId !== undefined && status === undefined) {
      updatedEntity.status = 'published';
    }

    // If config fields are being updated, create a new version
    if (hasConfigUpdate) {
      const latestVersion = await this.getLatestVersion(id);
      if (!latestVersion) {
        throw new Error(`No versions found for skill ${id}`);
      }

      const {
        id: _versionId,
        skillId: _skillId,
        versionNumber: _versionNumber,
        changedFields: _changedFields,
        changeMessage: _changeMessage,
        createdAt: _createdAt,
        ...latestConfig
      } = latestVersion;

      const newConfig = {
        ...latestConfig,
        ...configFields,
      };

      const changedFields = configFieldNames.filter(

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Recreate the skill (delete and re-create) so an initial version is written.
  2. Manually restore/repair the missing version file(s) in the storage directory.
  3. Update only metadata fields (authorId, visibility, activeVersionId, status) instead of config fields until a version exists.
  4. Check disk health/write process for the partial-write that dropped the versions.

Example fix

// before
await storage.update({ id: 'my-skill', instructions: 'new' }); // throws: no versions
// after
await storage.create({ skill: { id: 'my-skill', instructions: 'new', ...rest } }); // fresh skill+version
Defensive patterns

Strategy: validation

Validate before calling

const latest = await storage.getLatestVersion(id);
if (!latest) throw new Error(`skill ${id} has no version history; recreate it`);

Type guard

async function hasVersionHistory(storage: FilesystemSkillsStorage, id: string): Promise<boolean> {
  return (await storage.getLatestVersion(id)) != null;
}

Try / catch

try {
  return await storage.update(input);
} catch (e) {
  if (e instanceof Error && e.message.startsWith('No versions found for skill')) {
    logger.error(`skill ${id} has corrupt/missing version history; recreate required`);
    return null;
  }
  throw e;
}

Prevention

When it happens

Trigger: 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.

Common situations: Hand-editing or cleaning the storage directory; interrupted writes leaving skill metadata without versions; importing skills metadata without version files.

Related errors


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