bitwarden/server · error · BadRequestException

You cannot import this much data at once.

Error message

You cannot import this much data at once.

What it means

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.

Source

Thrown at src/Api/Tools/Controllers/ImportCiphersController.cs:53

        IImportCiphersCommand importCiphersCommand)
    {
        _userService = userService;
        _currentContext = currentContext;
        _logger = logger;
        _globalSettings = globalSettings;
        _collectionRepository = collectionRepository;
        _authorizationService = authorizationService;
        _importCiphersCommand = importCiphersCommand;
    }

    [HttpPost("import")]
    public async Task PostImport([FromBody] ImportCiphersRequestModel model)
    {
        if (!_globalSettings.SelfHosted &&
            (model.Ciphers.Count() > 7000 || model.FolderRelationships.Count() > 7000 ||
                model.Folders.Count() > 2000))
        {
            throw new BadRequestException("You cannot import this much data at once.");
        }

        var userId = _userService.GetProperUserId(User) ?? throw new InvalidOperationException("User ID not found");
        var folders = model.Folders.Select(f => f.ToFolder(userId)).ToList();
        var ciphers = model.Ciphers.Select(c => c.ToCipherDetails(userId, false)).ToList();
        await _importCiphersCommand.ImportIntoIndividualVaultAsync(folders, ciphers, model.FolderRelationships, userId);
    }

    [HttpPost("import-organization")]
    public async Task PostImportOrganization([FromQuery] string organizationId,
        [FromBody] ImportOrganizationCiphersRequestModel model)
    {
        if (!_globalSettings.SelfHosted &&
            (model.Ciphers.Length > _globalSettings.ImportCiphersLimitation.CiphersLimit ||
             model.CollectionRelationships.Length > _globalSettings.ImportCiphersLimitation.CollectionRelationshipsLimit ||
             model.Collections.Length > _globalSettings.ImportCiphersLimitation.CollectionsLimit ||
             model.Folders.Length > _globalSettings.ImportCiphersLimitation.FoldersLimit ||
             model.FolderRelationships.Length > _globalSettings.ImportCiphersLimitation.FolderRelationshipsLimit))

View on GitHub (pinned to e93b962371)

Solutions

  1. Split the import into multiple smaller batches: each under 7000 ciphers, 7000 folder relationships, and 2000 folders.
  2. If self-hosted, the limit does not apply — deploy your own instance for large imports.
  3. Reduce folder count by consolidating before import.

Example fix

// before: single request with 10000 ciphers
POST /ciphers/import  // all at once -> 400
// after: chunk into batches of <=7000
for (var batch : splitIntoBatches(allCiphers, 6000)) {
  POST /ciphers/import  // batch -> 200
}
Defensive patterns

Strategy: validation

Validate before calling

// Chunk individual vault import to stay under cloud limits
const int MaxCiphers = 7000, MaxFolders = 2000, MaxFolderRels = 7000;
foreach (var batch in SplitImport(model, maxCiphers: 6000, maxFolders: 1500))
{
    await importClient.ImportAsync(batch);
}
// SplitImport yields batches respecting all three limits

Prevention

When it happens

Trigger: POST /ciphers/import on Bitwarden Cloud with a payload containing >7000 ciphers, >7000 folder-cipher relationships, or >2000 folders.

Common situations: 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.

Related errors


AI-assisted analysis of bitwarden/server@e93b962371 (2026-08-13). Data as JSON: /api/errors/0a0e0a5da1353eb3. Report an issue: GitHub.