{"record":{"id":"9d1a04b80a6d1ff5","repo":"overleaf/overleaf","slug":"cannot-archive-split-test-with-id-name-not-f","errorCode":null,"errorMessage":"Cannot archive split test with ID '${name}': not found","messagePattern":"Cannot archive split test with ID '(.+?)': not found","errorType":"exception","errorClass":"Errors.NotFoundError","httpStatus":404,"severity":"error","filePath":"services/web/app/src/Features/SplitTests/SplitTestManager.mjs","lineNumber":414,"sourceCode":"        variant.userCount = correspondingVariant.userCount\n      }\n    }\n  } else {\n    for (const variant of previousVersionCopy.variants) {\n      if (variant.userCount) {\n        variant.userCount = 0\n      }\n    }\n  }\n\n  splitTest.versions.push(previousVersionCopy)\n  return _saveSplitTest(splitTest)\n}\n\nasync function archive(name, userId) {\n  const splitTest = await getSplitTest({ name })\n  if (!splitTest) {\n    throw new Errors.NotFoundError(\n      `Cannot archive split test with ID '${name}': not found`\n    )\n  }\n  if (splitTest.archived) {\n    throw new Errors.InvalidError(\n      `Split test with ID '${name}' is already archived`\n    )\n  }\n  splitTest.archived = true\n  splitTest.archivedAt = new Date()\n  splitTest.archivedBy = userId\n  return _saveSplitTest(splitTest)\n}\n\nasync function clearCache() {\n  await CacheFlow.reset('split-test')\n}\n","sourceCodeStart":396,"sourceCodeEnd":432,"githubUrl":"https://github.com/overleaf/overleaf/blob/28ad3b03b71cb4311decdcb55c36b33ec10d72db/services/web/app/src/Features/SplitTests/SplitTestManager.mjs#L396-L432","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","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."],"exampleFix":"// before\nawait SplitTestManager.promises.archive('saplit-test', userId) // typo\n// after\nconst splitTest = await SplitTestManager.promises.getSplitTest({ name: 'saplit-test' })\nif (!splitTest) throw new Errors.NotFoundError({ message: 'no such split test' })\nawait SplitTestManager.promises.archive('saplit-test', userId)","handlingStrategy":"validation","validationCode":"const splitTest = await SplitTestManager.promises.getSplitTest({ name })\nif (!splitTest) throw new Error(`split test '${name}' does not exist in this environment`)","typeGuard":"function splitTestExists(result) {\n  return result != null && typeof result === 'object' && typeof result.name === 'string'\n}","tryCatchPattern":"try {\n  await SplitTestManager.promises.archive(name, userId)\n} catch (err) {\n  if (err instanceof Errors.NotFoundError) {\n    // return 404 with the offending name\n  } else throw err\n}","preventionTips":["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"],"tags":["split-tests","not-found","archive","bad-request-input"],"backgroundTag":"resource-not-found","analyzedSha":"28ad3b03b71cb4311decdcb55c36b33ec10d72db","analyzedAt":"2026-09-03T02:10:22.807Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}