mastra-ai/mastra · error · HTTPException

Version with id ${from} not found

Error message

Version with id ${from} not found

What it means

This 404 is thrown by the scorer-versions copy-configuration handler when `scorerStore.getVersion(from)` returns no version for the `from` version id supplied in the request. The server validates that both source and target versions exist before copying configuration between scorer versions. It means the referenced version id does not exist in the scorer storage.

Source

Thrown at packages/server/src/server/handlers/scorer-versions.ts:469

  tags: ['Scorer Versions'],
  handler: async ({ mastra, scorerId, from, to, requestContext }) => {
    try {
      const storage = mastra.getStorage();

      if (!storage) {
        throw new HTTPException(500, { message: 'Storage is not configured' });
      }

      const scorerStore = await storage.getStore('scorerDefinitions');
      if (!scorerStore) {
        throw new HTTPException(500, { message: 'Scorer definitions storage domain is not available' });
      }
      const scorer = await scorerStore.getById(scorerId);
      assertStoredResourceScope(scorer, await getStoredResourceScope(mastra, requestContext));

      const fromVersion = await scorerStore.getVersion(from);
      if (!fromVersion) {
        throw new HTTPException(404, { message: `Version with id ${from} not found` });
      }
      if (fromVersion.scorerDefinitionId !== scorerId) {
        throw new HTTPException(404, {
          message: `Version with id ${from} not found for scorer ${scorerId}`,
        });
      }

      const toVersion = await scorerStore.getVersion(to);
      if (!toVersion) {
        throw new HTTPException(404, { message: `Version with id ${to} not found` });
      }
      if (toVersion.scorerDefinitionId !== scorerId) {
        throw new HTTPException(404, {
          message: `Version with id ${to} not found for scorer ${scorerId}`,
        });
      }

      const fromConfig = extractConfigFromVersion(

View on GitHub (pinned to 75dd419e61)

Solutions

  1. List the scorer's versions via the scorers API/storage to confirm the correct `from` version id exists.
  2. Check that you are connected to the storage backend (database) that actually contains the version.
  3. Correct the `from` id in your request payload or URL.
  4. If the version was deleted, recreate it or pick an existing version as the source.

Example fix

// before
await fetch(`/api/scorers/${scorerId}/versions/copy`, { method: 'POST', body: JSON.stringify({ from: 'stale-version-id', to: currentVersionId }) });
// after
const versions = await fetch(`/api/scorers/${scorerId}/versions`).then(r => r.json());
const from = versions[0].id; // use a version id that actually exists
await fetch(`/api/scorers/${scorerId}/versions/copy`, { method: 'POST', body: JSON.stringify({ from, to: currentVersionId }) });
Defensive patterns

Strategy: validation

Validate before calling

const versions = await fetch(`/api/scorers/${scorerId}/versions`).then(r => r.json());
if (!versions.some(v => v.id === fromId)) throw new Error(`from version ${fromId} does not exist for ${scorerId}`);

Try / catch

try {
  await copyScorerVersionConfig({ scorerId, from, to });
} catch (e) {
  if (e instanceof MastraClientError && e.status === 404) {
    console.error(`Version '${from}' not found; fetch valid versions and retry with an existing id.`);
  } else throw e;
}

Prevention

When it happens

Trigger: Calling the scorer version config-copy endpoint with a `from` version id that was never created, was deleted, or belongs to another Mastra instance/storage backend.

Common situations: Copy-pasting a stale version id from logs or an old database; switching environments (dev vs prod storage) where version ids differ; typos in the version UUID; using a version id from a deleted scorer definition.

Related errors


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