Dokploy/dokploy · error · TRPCError

UNAUTHORIZED

UNAUTHORIZED

Error message

You need to use a server to create a compose

What it means

Guard inside createDiscordNotification: the notifications destination INSERT returned nothing after the discord row insert, so the transaction rolls back and nothing is created.

Source

Thrown at apps/dokploy/server/api/routers/ai.ts:349

					...input,
					organizationId: ctx.session.activeOrganizationId,
				});
			} catch (error) {
				throw new TRPCError({
					code: "BAD_REQUEST",
					message: error instanceof Error ? error?.message : `Error: ${error}`,
				});
			}
		}),
	deploy: protectedProcedure
		.input(deploySuggestionSchema)
		.mutation(async ({ ctx, input }) => {
			const environment = await findEnvironmentById(input.environmentId);
			const project = await findProjectById(environment.projectId);
			await checkServiceAccess(ctx, environment.projectId, "create");

			if (IS_CLOUD && !input.serverId) {
				throw new TRPCError({
					code: "UNAUTHORIZED",
					message: "You need to use a server to create a compose",
				});
			}

			const projectName = slugify(`${project.name} ${input.id}`);

			const compose = await createComposeByTemplate({
				...input,
				composeFile: input.dockerCompose,
				env: input.envVariables,
				serverId: input.serverId,
				name: input.name,
				sourceType: "raw",
				appName: `${projectName}-${generatePassword(6)}`,
				environmentId: input.environmentId,
			});

View on GitHub (pinned to 546686ea35)

Solutions

  1. Verify notifications constraints and that the destination enum includes 'discord'
  2. Apply pending migrations
  3. Reproduce with raw SQL to identify the violated constraint
Defensive patterns

Strategy: validation

Validate before calling

if (!input.name?.trim()) throw new Error('Notification name is required');

Try / catch

try { await createDiscordNotification(input); } catch (e) { if (e?.message?.includes('Inserting notification')) { /* check notifications constraints */ } throw e; }

Prevention

When it happens

Trigger: notifications insert violating NOT NULL/enum constraints (type not accepting 'discord'); schema drift; aborted transaction.

Common situations: Required column added to notifications without default; enum missing the discord destination type.

Related errors


AI-assisted analysis of Dokploy/dokploy@546686ea35 (2026-08-27). Data as JSON: /api/errors/57d3968433e3f981. Report an issue: GitHub.