appsmithorg/appsmith · error · Error
Organization with slug 'default' not found in database
Error message
Organization with slug 'default' not found in database
What it means
Thrown after enable_form_login.ts queries MongoDB via mongosh for an organization with slug 'default'. The script runs mongosh --eval "db.organization.findOne({slug:'default'},{_id:1,slug:1})" --json and JSON.parses the result; if the parsed object is null or lacks an _id, no default organization exists and the form-login toggle cannot be applied, so it throws.
Source
Thrown at app/client/packages/rts/src/ctl/enable_form_login.ts:37
await utils.ensureSupervisorIsRunning();
let organizationId: string;
try {
// First, check if the organization exists
const orgCheckResult = await utils.execCommandReturningOutput([
"mongosh",
dbUrl,
"--eval",
"db.organization.findOne({slug:'default'},{_id:1,slug:1})",
"--json",
]);
const orgData = JSON.parse(orgCheckResult);
if (!orgData || !orgData._id) {
throw new Error("Organization with slug 'default' not found in database");
}
console.log("Found organization:", orgData.slug);
// Update the organization to enable form login
await utils.execCommand([
"mongosh",
dbUrl,
"--eval",
"db.organization.updateOne({slug:'default'}, {$set:{'organizationConfiguration.isFormLoginEnabled':true}})",
"--json",
]);
organizationId = orgData._id.$oid;
console.log("Organization ID:", organizationId);
console.log("Successfully updated organization configuration");
} catch (error) {View on GitHub (pinned to 8cd9021c24)
Solutions
- Verify the MongoDB URI selects the correct database and that a default org exists: run mongosh with the same URI and 'db.organization.findOne({slug:"default"})'.
- If the default org genuinely does not exist, run the Appsmith bootstrap/initialization that seeds it before enabling form login.
- Check whether the org slug was customized and adjust expectations or seed data accordingly.
- Confirm mongosh is the same version the script expects so the --json output shape parses (older/newer mongosh can emit different JSON envelopes).
Example fix
# before
# db has no {slug:'default'} document
$ appsmith ctl enable-form-login
# -> Organization with slug 'default' not found in database
# after
# seed the default org via the Appsmith bootstrap, then:
$ appsmith ctl enable-form-login Defensive patterns
Strategy: validation
Validate before calling
// pre-check via mongosh before invoking the ctl logic
const out = execSync(`mongosh "${dbUrl}" --eval "db.organization.findOne({slug:'default'},{_id:1})" --json`).toString();
if (!JSON.parse(out)?._id) throw new Error('Seed the default organization first.'); Type guard
const hasOrgId = (o: unknown): o is { _id: string } =>
typeof o === 'object' && o !== null && '_id' in o; Try / catch
try { await enableFormLogin(); } catch (e) {
if (/Organization with slug 'default' not found/i.test(e.message)) { await runBootstrap(); await enableFormLogin(); }
else throw e;
} Prevention
- Run the org-seeding bootstrap before any ctl that toggles org settings.
- Pin the mongosh version so --json output shape stays stable.
- Verify the DB name in the URI points at the right database.
When it happens
Trigger: Running enable-form-login against a database that has no organization document with slug:'default' — e.g. a database initialized differently, a non-default slug, the wrong database selected by the URI, or a fresh DB where the bootstrap that creates the default org has not run.
Common situations: Pointing APPSMITH_DB_URL at the wrong database name in the URI; restored backup whose org slug was renamed; multi-tenant install where the default org was deleted; bootstrap migration that creates the default org not yet executed.
Related errors
- Database URL not found. Please check APPSMITH_DB_URL or APPS
- Not enough space available at /appsmith-stacks. Please ensur
- Backup process aborted because a valid encryption password c
- Redis URL not found. Please check APPSMITH_REDIS_URL configu
- Failed to send error mail. Email provider is not configured,
AI-assisted analysis of appsmithorg/appsmith@8cd9021c24 (2026-08-12).
Data as JSON: /api/errors/67f42d51683913c9.
Report an issue: GitHub.