appwrite/appwrite · error · Appwrite\Extend\Exception

collection_limit_exceeded

collection_limit_exceeded

Error message

The maximum number of collections for database '%s' has been reached.

What it means

Provisioning the metadata collection hit the adapter's LimitException: the maximum number of collections allowed for this database (per-plan or adapter cap) has been reached, so even the first metadata collection cannot be created. The message names the database ID that exhausted the cap.

Solutions

  1. Delete unused collections or databases to free quota, then retry.
  2. Raise the collections limit in the plan / console settings (or upgrade the plan).
  3. Create the new database under a different project that still has quota.
Defensive patterns

Strategy: validation

Validate before calling

async function canCreateCollections(databases, project) {
  const usage = await project.getUsage(); // compare collections usage/limit before provisioning
  return usage.collections.current < usage.collections.limit;
}
// only provision new databases when quota headroom exists

Try / catch

try {
  await databases.create(dbId, name);
} catch (e) {
  if (e.code === 'collection_limit_exceeded') {
    // free quota: delete unused collections/databases, or raise plan limit, then retry
  }
  throw e;
}

Prevention

When it happens

Trigger: Creating a database when the plan's collections-per-database cap is already exhausted or zero for the project; project-wide collection quotas consumed by other databases on shared-adapter deployments.

Common situations: Plan downgrades shrinking quotas below current usage; bulk provisioning scripts creating many databases/collections; self-hosted custom limits set too low.

Related errors


AI-assisted analysis of appwrite/appwrite@ca3c55abfe (2026-08-18). Data as JSON: /api/errors/28f87176b98f2154. Report an issue: GitHub.

Appendix: source

Thrown at src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php:156

        $attributes = [];
        foreach ($collections['attributes'] as $attribute) {
            $attributes[] = new Document($attribute);
        }

        $indexes = [];
        foreach ($collections['indexes'] as $index) {
            $indexes[] = new Document($index);
        }

        try {
            $dbForProject->createCollection('database_' . $database->getSequence(), $attributes, $indexes);
        } catch (DuplicateException) {
            throw new Exception(Exception::DATABASE_ALREADY_EXISTS, params: [$database->getId()]);
        } catch (IndexException $e) {
            throw new Exception(Exception::INDEX_INVALID);
        } catch (LimitException) {
            throw new Exception(Exception::COLLECTION_LIMIT_EXCEEDED, params: [$database->getId()]);
        }
    }
}

View on GitHub (pinned to ca3c55abfe)