{"record":{"id":"e72cbfc484c8d7b6","repo":"appsmithorg/appsmith","slug":"database-url-not-found-please-check-appsmith-db-u","errorCode":null,"errorMessage":"Database URL not found. Please check APPSMITH_DB_URL or APPSMITH_MONGODB_URI configuration.","messagePattern":"Database URL not found\\. Please check APPSMITH_DB_URL or APPSMITH_MONGODB_URI configuration\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"app/client/packages/rts/src/ctl/enable_form_login.ts","lineNumber":9,"sourceCode":"import * as utils from \"./utils\";\n\nexport async function run() {\n  const dbUrl = utils.getDburl();\n  const redisUrl = utils.getRedisUrl();\n\n  // Validate required configuration\n  if (!dbUrl) {\n    throw new Error(\n      \"Database URL not found. Please check APPSMITH_DB_URL or APPSMITH_MONGODB_URI configuration.\",\n    );\n  }\n\n  if (!redisUrl) {\n    throw new Error(\n      \"Redis URL not found. Please check APPSMITH_REDIS_URL configuration.\",\n    );\n  }\n\n  await utils.ensureSupervisorIsRunning();\n\n  let organizationId: string;\n\n  try {\n    // First, check if the organization exists\n    const orgCheckResult = await utils.execCommandReturningOutput([\n      \"mongosh\",","sourceCodeStart":1,"sourceCodeEnd":27,"githubUrl":"https://github.com/appsmithorg/appsmith/blob/8cd9021c24cdbea1c3c12c966073708e83db60c2/app/client/packages/rts/src/ctl/enable_form_login.ts#L1-L27","documentation":"Thrown by run() in enable_form_login.ts when utils.getDburl() returns falsy. getDburl() is expected to read APPSMITH_DB_URL or APPSMITH_MONGODB_URI; without a MongoDB connection string the script cannot run mongosh to toggle form login on the default organization, so it aborts up front.","triggerScenarios":"Running 'appsmith ctl enable-form-login' (or equivalent) in a container/shell where neither APPSMITH_DB_URL nor APPSMITH_MONGODB_URI is set, or where getDburl() returns undefined because the underlying reader has no fallback.","commonSituations":"Running the ctl in a one-off 'docker exec' shell that does not load /appsmith-stacks/runtime.env; env var renamed between Appsmith versions; fresh install where the bootstrap env has not been written; misconfigured stack.env.","solutions":["Set APPSMITH_DB_URL (or APPSMITH_MONGODB_URI) to a valid MongoDB URI before running the ctl.","Source the runtime env first: '. /appsmith-stacks/runtime.env' inside the container shell, then re-run.","Confirm the var is exported in the shell with 'echo $APPSMITH_DB_URL' (prints the name only, never log the value).","Verify utils.getDburl() actually reads the var name you set — check for a rename in your Appsmith version."],"exampleFix":"# before\n$ appsmith ctl enable-form-login\n# -> Database URL not found...\n\n# after\n$ export APPSMITH_DB_URL='mongodb://...'\n$ appsmith ctl enable-form-login","handlingStrategy":"validation","validationCode":"const dbUrl = process.env.APPSMITH_DB_URL || process.env.APPSMITH_MONGODB_URI;\nif (!dbUrl) throw new Error('Set APPSMITH_DB_URL or APPSMITH_MONGODB_URI before running the ctl.');","typeGuard":"const hasDbUrl = (env: NodeJS.ProcessEnv): boolean =>\n  Boolean(env.APPSMITH_DB_URL || env.APPSMITH_MONGODB_URI);","tryCatchPattern":null,"preventionTips":["Source /appsmith-stacks/runtime.env before running ctls.","Centralize required-env checks in a shared bootstrap used by every ctl.","Fail fast in container entrypoints if required env is missing."],"tags":["configuration","environment-variables","database","mongodb","rts","operations"],"backgroundTag":null,"analyzedSha":"8cd9021c24cdbea1c3c12c966073708e83db60c2","analyzedAt":"2026-08-12T22:14:19.293Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}