{"record":{"id":"28f87176b98f2154","repo":"appwrite/appwrite","slug":"collection-limit-exceeded-28f871","errorCode":"collection_limit_exceeded","errorMessage":"The maximum number of collections for database '%s' has been reached.","messagePattern":"The maximum number of collections for database '(.+?)' has been reached\\.","errorType":"exception","errorClass":"Appwrite\\Extend\\Exception","httpStatus":400,"severity":"error","filePath":"src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php","lineNumber":154,"sourceCode":"\n        $attributes = [];\n        foreach ($collections['attributes'] as $attribute) {\n            $attributes[] = new Document($attribute);\n        }\n\n        $indexes = [];\n        foreach ($collections['indexes'] as $index) {\n            $indexes[] = new Document($index);\n        }\n\n        try {\n            $dbForProject->createCollection('database_' . $database->getSequence(), $attributes, $indexes);\n        } catch (DuplicateException) {\n            throw new Exception(Exception::DATABASE_ALREADY_EXISTS, params: [$database->getId()]);\n        } catch (IndexException $e) {\n            throw new Exception(Exception::INDEX_INVALID);\n        } catch (LimitException) {\n            throw new Exception(Exception::COLLECTION_LIMIT_EXCEEDED, params: [$database->getId()]);\n        }\n    }\n}\n","sourceCodeStart":136,"sourceCodeEnd":158,"githubUrl":"https://github.com/appwrite/appwrite/blob/a1d520eea492ebd1da1ef2dc8db5b2b34e277dce/src/Appwrite/Platform/Modules/Databases/Http/Databases/Create.php#L136-L158","documentation":"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.","triggerScenarios":"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.","commonSituations":"Plan downgrades shrinking quotas below current usage; bulk provisioning scripts creating many databases/collections; self-hosted custom limits set too low.","solutions":["Delete unused collections or databases to free quota, then retry.","Raise the collections limit in the plan / console settings (or upgrade the plan).","Create the new database under a different project that still has quota."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"async function canCreateCollections(databases, project) {\n  const usage = await project.getUsage(); // compare collections usage/limit before provisioning\n  return usage.collections.current < usage.collections.limit;\n}\n// only provision new databases when quota headroom exists","typeGuard":null,"tryCatchPattern":"try {\n  await databases.create(dbId, name);\n} catch (e) {\n  if (e.code === 'collection_limit_exceeded') {\n    // free quota: delete unused collections/databases, or raise plan limit, then retry\n  }\n  throw e;\n}","preventionTips":["Check project usage versus limits before bulk provisioning","Clean up abandoned databases before creating new ones","Alert when usage crosses ~80% of the collections quota"],"tags":["databases","collections","limits","plan","quota"],"backgroundTag":"resource-limit-exceeded","analyzedSha":"a1d520eea492ebd1da1ef2dc8db5b2b34e277dce","analyzedAt":"2026-08-18T21:34:56.994Z","contentChangedAt":"2026-08-18T21:34:56.994Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}