overleaf/overleaf · error · Errors.NotFoundError
Cannot archive split test with ID '${name}': not found
Error message
Cannot archive split test with ID '${name}': not found What it means
Thrown by SplitTestManager.archive when no split test exists with the given name. The manager first loads the test with getSplitTest({ name }) and throws Errors.NotFoundError if the lookup returns null/undefined. Archiving is only valid for an existing, currently-unarchived test.
Source
Thrown at services/web/app/src/Features/SplitTests/SplitTestManager.mjs:414
variant.userCount = correspondingVariant.userCount
}
}
} else {
for (const variant of previousVersionCopy.variants) {
if (variant.userCount) {
variant.userCount = 0
}
}
}
splitTest.versions.push(previousVersionCopy)
return _saveSplitTest(splitTest)
}
async function archive(name, userId) {
const splitTest = await getSplitTest({ name })
if (!splitTest) {
throw new Errors.NotFoundError(
`Cannot archive split test with ID '${name}': not found`
)
}
if (splitTest.archived) {
throw new Errors.InvalidError(
`Split test with ID '${name}' is already archived`
)
}
splitTest.archived = true
splitTest.archivedAt = new Date()
splitTest.archivedBy = userId
return _saveSplitTest(splitTest)
}
async function clearCache() {
await CacheFlow.reset('split-test')
}
View on GitHub (pinned to 28ad3b03b7)
Solutions
- Verify the split test name exists via getSplitTest({ name }) or an admin listing before calling archive.
- Check you are connected to the intended database/environment (staging vs production).
- Fix casing/typos in the name — names are matched exactly.
- Catch Errors.NotFoundError and return a 404 with a message identifying the missing split test name.
Example fix
// before
await SplitTestManager.promises.archive('saplit-test', userId) // typo
// after
const splitTest = await SplitTestManager.promises.getSplitTest({ name: 'saplit-test' })
if (!splitTest) throw new Errors.NotFoundError({ message: 'no such split test' })
await SplitTestManager.promises.archive('saplit-test', userId) Defensive patterns
Strategy: validation
Validate before calling
const splitTest = await SplitTestManager.promises.getSplitTest({ name })
if (!splitTest) throw new Error(`split test '${name}' does not exist in this environment`) Type guard
function splitTestExists(result) {
return result != null && typeof result === 'object' && typeof result.name === 'string'
} Try / catch
try {
await SplitTestManager.promises.archive(name, userId)
} catch (err) {
if (err instanceof Errors.NotFoundError) {
// return 404 with the offending name
} else throw err
} Prevention
- Copy split test names from a listing rather than typing them
- Check DB/environment connection (staging vs production) before admin operations
- Treat NotFoundError as a 404 with the name echoed back
When it happens
Trigger: Calling archive(name, userId) where name does not match any persisted split test (typo, test deleted, wrong environment/database, or test referenced from config that was never synced to the DB).
Common situations: Typo in the split test name; running against a staging DB while the test only exists in production (or vice versa); a test removed from the splitTests collection but still referenced by cached feature-flag config; case mismatch in the name.
Understand the failure class
Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.
Related errors
- Cannot revert split test with ID '${name}' to version number
- Cannot update split test '${name}': not found
- Split test with ID '${name}' is already archived
- file does not exist
- Output files not found
AI-assisted analysis of overleaf/overleaf@28ad3b03b7 (2026-09-03).
Data as JSON: /api/errors/9d1a04b80a6d1ff5.
Report an issue: GitHub.