{"record":{"id":"aad8d4f99b7a0da2","repo":"medusajs/medusa","slug":"the-specified-credentials-does-not-exists-for-the","errorCode":null,"errorMessage":"The specified credentials does not exists for the specified PostgreSQL database.${EOL}${err.message}","messagePattern":"The specified credentials does not exists for the specified PostgreSQL database\\.(.+?)(.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/core/utils/src/common/handle-postgres-database-error.ts","lineNumber":31,"sourceCode":"    throw new Error(\n      `The specified PostgreSQL database does not exist. Please create it and try again.${EOL}${err.message}`\n    )\n  }\n\n  if (DatabaseErrorCode.connectionFailure === err.code) {\n    throw new Error(\n      `Failed to establish a connection to PostgreSQL. Please ensure the following is true and try again:\n      - You have a PostgreSQL database running\n      - You have passed the correct credentials in medusa-config.js\n      - You have formatted the database connection string correctly. See below:\n      \"postgres://[username]:[password]@[host]:[port]/[db_name]\" - If there is no password, you can omit it from the connection string\n      ${EOL}\n      ${err.message}`\n    )\n  }\n\n  if (DatabaseErrorCode.wrongCredentials === err.code) {\n    throw new Error(\n      `The specified credentials does not exists for the specified PostgreSQL database.${EOL}${err.message}`\n    )\n  }\n\n  if (DatabaseErrorCode.notFound === err.code) {\n    throw new Error(\n      `The specified connection string for your PostgreSQL database might have illegal characters. Please check that it only contains allowed characters [a-zA-Z0-9]${EOL}${err.message}`\n    )\n  }\n\n  if (DatabaseErrorCode.migrationMissing === err.code) {\n    throw new Error(\n      `Migrations missing. Please run 'medusa migrations run' and try again.`\n    )\n  }\n\n  throw err\n}","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/medusajs/medusa/blob/5e06e544a296b9033f20f71f11c559f81a0e5739/packages/core/utils/src/common/handle-postgres-database-error.ts#L13-L49","documentation":"Maps PostgreSQL authentication failures (e.g. 28P01 password authentication failed) to a clear message: the server was reached but the username/password pair was rejected.","triggerScenarios":"Wrong POSTGRES_PASSWORD/DATABASE_URL password, user doesn't exist, or pg_hba.conf requiring a different auth method.","commonSituations":"Rotated credentials, env var mismatch between .env and docker-compose, special characters in the password not URL-encoded in the connection string.","solutions":["Verify username/password against the Postgres server (psql connect test)","URL-encode special characters in the password inside DATABASE_URL","Check pg_hba.conf auth method and the user exists"],"exampleFix":"# before (password with @ breaks parsing)\nDATABASE_URL=postgres://user:p@ss@localhost:5432/db\n# after\nDATABASE_URL=postgres://user:p%40ss@localhost:5432/db","handlingStrategy":"try-catch","validationCode":"// encode password properly\nconst u = new URL('postgres://localhost:5432/db')\nu.username = process.env.PGUSER; u.password = process.env.PGPASSWORD\nprocess.env.DATABASE_URL = u.toString()","typeGuard":null,"tryCatchPattern":"try { await connect() } catch (e) { if (/credentials does not exist|password authentication/i.test(e.message)) fail fast with a config checklist; else throw e }","preventionTips":["URL-encode special characters in passwords","Never duplicate credentials in multiple env sources"],"tags":["postgres","authentication","credentials","connection"],"backgroundTag":"database-authentication-failed","analyzedSha":"5e06e544a296b9033f20f71f11c559f81a0e5739","analyzedAt":"2026-08-27T07:24:39.599Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}