mastra-ai/mastra · error · HTTPException
Version with id ${to} not found
Error message
Version with id ${to} not found What it means
This 404 is thrown by the scorer-versions copy-config handler when `scorerStore.getVersion(to)` returns nothing, i.e. the destination `to` version id does not exist. The handler resolves the source first, then the target, and aborts before any configuration is written.
Source
Thrown at packages/server/src/server/handlers/scorer-versions.ts:479
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,
);
const toConfig = extractConfigFromVersion(
toVersion as unknown as Record<string, unknown>,
SNAPSHOT_CONFIG_FIELDS,
);
const diffs = computeVersionDiffs(fromConfig, toConfig);
View on GitHub (pinned to 75dd419e61)
Solutions
- List the scorer's versions and pick an existing id for `to`.
- Confirm the request targets the environment whose storage holds that version.
- Fix typos in the `to` version id.
- Create the target version first, then retry the copy.
Example fix
// before
body: JSON.stringify({ from: srcId, to: 'not-created-yet' })
// after
const target = await createScorerVersion(scorerId, draftConfig);
body: JSON.stringify({ from: srcId, to: target.id }) Defensive patterns
Strategy: validation
Validate before calling
const versions = await getScorerVersions(scorerId);
if (!versions.some(v => v.id === toId)) throw new Error(`to version ${toId} does not exist for ${scorerId}`); Try / catch
try {
await copyScorerVersionConfig({ scorerId, from, to });
} catch (e) {
if (e instanceof MastraClientError && e.status === 404) {
console.error(`Target version '${to}' not found — create it or pick an existing version.`);
} else throw e;
} Prevention
- Create the destination version before copying configuration into it.
- Refresh your version list after any create/delete operations.
- Avoid hard-coded version ids in scripts; pass them as parameters resolved at runtime.
When it happens
Trigger: Calling the copy-config endpoint with a `to` version id that is not present in scorer storage (typo, deleted version, wrong environment).
Common situations: Targeting a version that was created after your client snapshot was taken... i.e. reversed: targeting a version that was deleted; hard-coding a `to` id from a different database; passing a draft/unsaved version id.
Related errors
- Version with id ${from} not found
- Model "${modelId}" is not available. Available models: ${ids
- ACP connection is not initialized
- Model "${this.options.model}" is not available. Available mo
- ClaudeSDKAgent resumeData must include either sessionId or c
AI-assisted analysis of mastra-ai/mastra@75dd419e61 (2026-08-30).
Data as JSON: /api/errors/44d001e7efb435cf.
Report an issue: GitHub.