{"record":{"id":"59245d2ceb6d16e7","repo":"Dokploy/dokploy","slug":"conflict-59245d","errorCode":"CONFLICT","errorMessage":"Service with this 'AppName' already exists","messagePattern":"Service with this 'AppName' already exists","errorType":"exception","errorClass":"TRPCError","httpStatus":409,"severity":"warning","filePath":"packages/server/src/services/mariadb.ts","lineNumber":27,"sourceCode":"import { buildMariadb } from \"@dokploy/server/utils/databases/mariadb\";\nimport { pullImage } from \"@dokploy/server/utils/docker/utils\";\nimport { execAsyncRemote } from \"@dokploy/server/utils/process/execAsync\";\nimport { TRPCError } from \"@trpc/server\";\nimport { eq, getTableColumns } from \"drizzle-orm\";\nimport { quote } from \"shell-quote\";\nimport type { z } from \"zod\";\nimport { validUniqueServerAppName } from \"./project\";\n\nexport type Mariadb = typeof mariadb.$inferSelect;\n\nexport const createMariadb = async (\n\tinput: z.infer<typeof apiCreateMariaDB>,\n) => {\n\tconst appName = buildAppName(\"mariadb\", input.appName);\n\n\tconst valid = await validUniqueServerAppName(appName);\n\tif (!valid) {\n\t\tthrow new TRPCError({\n\t\t\tcode: \"CONFLICT\",\n\t\t\tmessage: \"Service with this 'AppName' already exists\",\n\t\t});\n\t}\n\n\tconst newMariadb = await db\n\t\t.insert(mariadb)\n\t\t.values({\n\t\t\t...input,\n\t\t\tdatabasePassword: input.databasePassword\n\t\t\t\t? input.databasePassword\n\t\t\t\t: generatePassword(),\n\t\t\tdatabaseRootPassword: input.databaseRootPassword\n\t\t\t\t? input.databaseRootPassword\n\t\t\t\t: generatePassword(),\n\t\t\tappName,\n\t\t})\n\t\t.returning()","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/services/mariadb.ts#L9-L45","documentation":"Thrown by createMariadb when validUniqueServerAppName finds the prefixed appName ('mariadb-<name>') already exists on the server. It is Dokploy's duplicate-name guard and maps to HTTP 409 CONFLICT.","triggerScenarios":"Calling createMariadb with an appName whose 'mariadb-'-prefixed form collides with an existing application or service name in the database.","commonSituations":"Terraform/scripted provisioning re-running without unique names, common names like 'db' already claimed, or names still reserved by soft-deleted apps.","solutions":["Pick a unique appName and retry","List existing apps to find the conflicting name","Free the name by fully deleting the old service if it's obsolete"],"exampleFix":"// before\nawait createMariadb({ appName: 'db' }); // 409\n\n// after\nawait createMariadb({ appName: 'db-orders-prod' });","handlingStrategy":"validation","validationCode":"const apps = await trpc.admin.listApps.query();\nif (apps.some(a => a.name === `mariadb-${input.appName}`)) throw new Error('Name taken');","typeGuard":null,"tryCatchPattern":"try { await createMariadb(input); } catch (e) { if (e.shape?.data?.code === 'CONFLICT') { input.appName = uniqueify(input.appName); await createMariadb(input); } }","preventionTips":["Use environment-scoped names in IaC scripts","Check the app list before creation"],"tags":["validation","conflict","duplicate-app-name","mariadb"],"backgroundTag":"duplicate-resource-name-conflict","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}