{"record":{"id":"26b9ec0f82cb1ca4","repo":"Dokploy/dokploy","slug":"conflict-26b9ec","errorCode":"CONFLICT","errorMessage":"Service with this 'AppName' already exists","messagePattern":"Service with this 'AppName' already exists","errorType":"exception","errorClass":"TRPCError","httpStatus":409,"severity":"error","filePath":"packages/server/src/services/redis.ts","lineNumber":25,"sourceCode":"import { generatePassword } from \"@dokploy/server/templates\";\nimport { buildRedis } from \"@dokploy/server/utils/databases/redis\";\nimport { pullImage } from \"@dokploy/server/utils/docker/utils\";\nimport { execAsyncRemote } from \"@dokploy/server/utils/process/execAsync\";\nimport { TRPCError } from \"@trpc/server\";\nimport { eq } from \"drizzle-orm\";\nimport { quote } from \"shell-quote\";\nimport type { z } from \"zod\";\nimport { validUniqueServerAppName } from \"./project\";\n\nexport type Redis = typeof redis.$inferSelect;\n\n// https://github.com/drizzle-team/drizzle-orm/discussions/1483#discussioncomment-7523881\nexport const createRedis = async (input: z.infer<typeof apiCreateRedis>) => {\n\tconst appName = buildAppName(\"redis\", 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 newRedis = await db\n\t\t.insert(redis)\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\tappName,\n\t\t})\n\t\t.returning()\n\t\t.then((value) => value[0]);\n\n\tif (!newRedis) {","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/services/redis.ts#L7-L43","documentation":"createRedis builds an app name via buildAppName('redis', input.appName) and checks uniqueness with validUniqueServerAppName across the target server. If the generated AppName is already taken, CONFLICT is returned: each service on a server must have a unique app name.","triggerScenarios":"POST createRedis with an appName (or auto-derived name) that collides with an existing redis (or other) service's AppName on the same server.","commonSituations":"Creating a second redis service with the same custom appName; previous redis deployment with the same name still exists (stopped or soft-deleted); name collisions after recreating services from a template.","solutions":["Choose a different appName for the new redis service","List existing services on the server and remove/rename the conflicting one","If the old service was deleted but the name is still reserved, check for orphaned records"],"exampleFix":"// before\nawait createRedis({ appName: 'cache', ... });\n// after\nawait createRedis({ appName: 'cache-2', ... });","handlingStrategy":"validation","validationCode":"const appName = buildAppName('redis', input.appName);\nconst unique = await validUniqueServerAppName(appName);\nif (!unique) { /* pick another appName before creating */ }","typeGuard":null,"tryCatchPattern":"try { await createRedis(input) } catch (e) { if (e instanceof TRPCError && e.code === 'CONFLICT') { /* prompt user for a new appName */ } }","preventionTips":["Check name availability inline in the create form","Suggest suffixed names (cache-2) on conflict"],"tags":["trpc","redis","conflict","unique-constraint","app-name"],"backgroundTag":"duplicate-resource-name","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}