{"record":{"id":"0a0e0a5da1353eb3","repo":"bitwarden/server","slug":"you-cannot-import-this-much-data-at-once-0a0e0a","errorCode":null,"errorMessage":"You cannot import this much data at once.","messagePattern":"You cannot import this much data at once\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"src/Api/Tools/Controllers/ImportCiphersController.cs","lineNumber":53,"sourceCode":"        IImportCiphersCommand importCiphersCommand)\n    {\n        _userService = userService;\n        _currentContext = currentContext;\n        _logger = logger;\n        _globalSettings = globalSettings;\n        _collectionRepository = collectionRepository;\n        _authorizationService = authorizationService;\n        _importCiphersCommand = importCiphersCommand;\n    }\n\n    [HttpPost(\"import\")]\n    public async Task PostImport([FromBody] ImportCiphersRequestModel model)\n    {\n        if (!_globalSettings.SelfHosted &&\n            (model.Ciphers.Count() > 7000 || model.FolderRelationships.Count() > 7000 ||\n                model.Folders.Count() > 2000))\n        {\n            throw new BadRequestException(\"You cannot import this much data at once.\");\n        }\n\n        var userId = _userService.GetProperUserId(User) ?? throw new InvalidOperationException(\"User ID not found\");\n        var folders = model.Folders.Select(f => f.ToFolder(userId)).ToList();\n        var ciphers = model.Ciphers.Select(c => c.ToCipherDetails(userId, false)).ToList();\n        await _importCiphersCommand.ImportIntoIndividualVaultAsync(folders, ciphers, model.FolderRelationships, userId);\n    }\n\n    [HttpPost(\"import-organization\")]\n    public async Task PostImportOrganization([FromQuery] string organizationId,\n        [FromBody] ImportOrganizationCiphersRequestModel model)\n    {\n        if (!_globalSettings.SelfHosted &&\n            (model.Ciphers.Length > _globalSettings.ImportCiphersLimitation.CiphersLimit ||\n             model.CollectionRelationships.Length > _globalSettings.ImportCiphersLimitation.CollectionRelationshipsLimit ||\n             model.Collections.Length > _globalSettings.ImportCiphersLimitation.CollectionsLimit ||\n             model.Folders.Length > _globalSettings.ImportCiphersLimitation.FoldersLimit ||\n             model.FolderRelationships.Length > _globalSettings.ImportCiphersLimitation.FolderRelationshipsLimit))","sourceCodeStart":35,"sourceCodeEnd":71,"githubUrl":"https://github.com/bitwarden/server/blob/e93b962371d80964556f5590c6615f5160a437a1/src/Api/Tools/Controllers/ImportCiphersController.cs#L35-L71","documentation":"Thrown by PostImport (POST /ciphers/import) on cloud (non-self-hosted) instances when the individual-vault import payload exceeds hardcoded limits: more than 7000 ciphers, more than 7000 folder relationships, or more than 2000 folders. These limits protect cloud infrastructure from oversized single-request imports. Self-hosted instances are exempt.","triggerScenarios":"POST /ciphers/import on Bitwarden Cloud with a payload containing >7000 ciphers, >7000 folder-cipher relationships, or >2000 folders.","commonSituations":"Migrating from another password manager with a very large vault; importing a backup that exceeds the per-request cap; bulk provisioning scripts that don't chunk.","solutions":["Split the import into multiple smaller batches: each under 7000 ciphers, 7000 folder relationships, and 2000 folders.","If self-hosted, the limit does not apply — deploy your own instance for large imports.","Reduce folder count by consolidating before import."],"exampleFix":"// before: single request with 10000 ciphers\nPOST /ciphers/import  // all at once -> 400\n// after: chunk into batches of <=7000\nfor (var batch : splitIntoBatches(allCiphers, 6000)) {\n  POST /ciphers/import  // batch -> 200\n}","handlingStrategy":"validation","validationCode":"// Chunk individual vault import to stay under cloud limits\nconst int MaxCiphers = 7000, MaxFolders = 2000, MaxFolderRels = 7000;\nforeach (var batch in SplitImport(model, maxCiphers: 6000, maxFolders: 1500))\n{\n    await importClient.ImportAsync(batch);\n}\n// SplitImport yields batches respecting all three limits","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always chunk large imports into batches well under the 7000/2000 limits.","Use self-hosted for one-time very large migrations.","Monitor response sizes and pre-count ciphers/folders before importing."],"tags":["import","rate-limit","vault","cloud","bitwarden"],"backgroundTag":null,"analyzedSha":"e93b962371d80964556f5590c6615f5160a437a1","analyzedAt":"2026-08-13T14:22:19.382Z","schemaVersion":2},"datasetVersion":"2026-08-13T19:17:28.613Z"}