mastra-ai/mastra · error · HTTPException

Version with id ${from} not found for scorer ${scorerId}

Error message

Version with id ${from} not found for scorer ${scorerId}

What it means

Thrown when the `from` version exists in the scorer store but its `scorerDefinitionId` does not match the `scorerId` in the URL. The handler deliberately returns 404 (rather than 403/409) to avoid leaking version ids across scorer definitions. It prevents copying configuration from a version belonging to a different scorer.

Source

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

      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(
        fromVersion as unknown as Record<string, unknown>,
        SNAPSHOT_CONFIG_FIELDS,
      );

View on GitHub (pinned to 75dd419e61)

Solutions

  1. Fetch versions scoped to the target scorerId and use one of those ids as `from`.
  2. Verify the URL's scorerId matches the scorer that owns the `from` version.
  3. If you intended a different scorer, change the scorerId in the request path instead.

Example fix

// before
const from = otherScorerVersionId;
await copyConfig({ scorerId: 'my-scorer', from, to });
// after
const versions = await getScorerVersions('my-scorer');
const from = versions.find(v => v.id === otherScorerVersionId)?.id ?? versions[0].id;
await copyConfig({ scorerId: 'my-scorer', from, to });
Defensive patterns

Strategy: validation

Validate before calling

const versions = await getScorerVersions(scorerId);
if (!versions.some(v => v.id === fromId)) throw new Error(`version ${fromId} does not belong to scorer ${scorerId}`);

Try / catch

try {
  await copyScorerVersionConfig({ scorerId, from, to });
} catch (e) {
  if (e instanceof MastraClientError && e.status === 404 && /for scorer/.test(e.message)) {
    console.error('Version/scorer mismatch — re-resolve ids from the correct scorer.');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling the copy-config endpoint for scorer A while passing a `from` version id that belongs to scorer B.

Common situations: Mixing up version ids between two scorers configured in the same project; caching version ids per-project but requesting against a different scorer; copying an example payload that references another scorer's versions.

Related errors


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