{"record":{"id":"57d3968433e3f981","repo":"Dokploy/dokploy","slug":"unauthorized-57d396","errorCode":"UNAUTHORIZED","errorMessage":"You need to use a server to create a compose","messagePattern":"You need to use a server to create a compose","errorType":"http","errorClass":"TRPCError","httpStatus":401,"severity":"error","filePath":"apps/dokploy/server/api/routers/ai.ts","lineNumber":349,"sourceCode":"\t\t\t\t\t...input,\n\t\t\t\t\torganizationId: ctx.session.activeOrganizationId,\n\t\t\t\t});\n\t\t\t} catch (error) {\n\t\t\t\tthrow new TRPCError({\n\t\t\t\t\tcode: \"BAD_REQUEST\",\n\t\t\t\t\tmessage: error instanceof Error ? error?.message : `Error: ${error}`,\n\t\t\t\t});\n\t\t\t}\n\t\t}),\n\tdeploy: protectedProcedure\n\t\t.input(deploySuggestionSchema)\n\t\t.mutation(async ({ ctx, input }) => {\n\t\t\tconst environment = await findEnvironmentById(input.environmentId);\n\t\t\tconst project = await findProjectById(environment.projectId);\n\t\t\tawait checkServiceAccess(ctx, environment.projectId, \"create\");\n\n\t\t\tif (IS_CLOUD && !input.serverId) {\n\t\t\t\tthrow new TRPCError({\n\t\t\t\t\tcode: \"UNAUTHORIZED\",\n\t\t\t\t\tmessage: \"You need to use a server to create a compose\",\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst projectName = slugify(`${project.name} ${input.id}`);\n\n\t\t\tconst compose = await createComposeByTemplate({\n\t\t\t\t...input,\n\t\t\t\tcomposeFile: input.dockerCompose,\n\t\t\t\tenv: input.envVariables,\n\t\t\t\tserverId: input.serverId,\n\t\t\t\tname: input.name,\n\t\t\t\tsourceType: \"raw\",\n\t\t\t\tappName: `${projectName}-${generatePassword(6)}`,\n\t\t\t\tenvironmentId: input.environmentId,\n\t\t\t});\n","sourceCodeStart":331,"sourceCodeEnd":367,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/apps/dokploy/server/api/routers/ai.ts#L331-L367","documentation":"Guard inside createDiscordNotification: the notifications destination INSERT returned nothing after the discord row insert, so the transaction rolls back and nothing is created.","triggerScenarios":"notifications insert violating NOT NULL/enum constraints (type not accepting 'discord'); schema drift; aborted transaction.","commonSituations":"Required column added to notifications without default; enum missing the discord destination type.","solutions":["Verify notifications constraints and that the destination enum includes 'discord'","Apply pending migrations","Reproduce with raw SQL to identify the violated constraint"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if (!input.name?.trim()) throw new Error('Notification name is required');","typeGuard":null,"tryCatchPattern":"try { await createDiscordNotification(input); } catch (e) { if (e?.message?.includes('Inserting notification')) { /* check notifications constraints */ } throw e; }","preventionTips":["Update destination enums when adding providers"],"tags":["database","drizzle","notification","transaction"],"backgroundTag":"database-insert-failed","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}