Dokploy/dokploy · error · TRPCError

CONFLICT

CONFLICT

Error message

Port ${port} (${name}) is already in use by ${portCheck.conflictingContainer}

What it means

Before updating ports, the procedure runs checkPortInUse against the target server; if another container already binds the requested port, it throws CONFLICT naming the conflicting container. This prevents Docker port binding failures at deploy time.

Source

Thrown at apps/dokploy/server/api/routers/libsql.ts:215

					port: input.externalGRPCPort,
					name: "externalGRPCPort",
					current: libsql.externalGRPCPort,
				},
				{
					port: input.externalAdminPort,
					name: "externalAdminPort",
					current: libsql.externalAdminPort,
				},
			];

			for (const { port, name, current } of portsToCheck) {
				if (port && port !== current) {
					const portCheck = await checkPortInUse(
						port,
						libsql.serverId || undefined,
					);
					if (portCheck.isInUse) {
						throw new TRPCError({
							code: "CONFLICT",
							message: `Port ${port} (${name}) is already in use by ${portCheck.conflictingContainer}`,
						});
					}
				}
			}

			await updateLibsqlById(input.libsqlId, {
				externalPort: input.externalPort,
				externalGRPCPort: input.externalGRPCPort,
				externalAdminPort: input.externalAdminPort,
			});
			await deployLibsql(input.libsqlId);
			await audit(ctx, {
				action: "update",
				resourceType: "service",
				resourceId: libsql.libsqlId,
				resourceName: libsql.appName,

View on GitHub (pinned to 546686ea35)

Solutions

  1. Choose a different, unused port for the field named in the message
  2. Stop/redeploy the conflicting container named in portCheck.conflictingContainer if it is stale
  3. Note that re-saving the same port value skips the check — ensure you actually changed the value if you expect validation to run on it

Example fix

// before
await api.libsql.update.mutate({ libsqlId, externalGRPCPort: 3000 }); // 3000 already used
// after
await api.libsql.update.mutate({ libsqlId, externalGRPCPort: 3001 });
Defensive patterns

Strategy: fallback

Validate before calling

const check = await api.docker.checkPort.query({ port, serverId });
if (check.isInUse) pickAnotherPort();

Try / catch

try { await update(port); } catch (e) { if (/already in use/i.test((e as Error).message)) autoIncrementPortAndRetry(); }

Prevention

When it happens

Trigger: Submitting an update that changes a port (e.g. externalGRPCPort) to a value already bound by another container on the same server; the check only runs when the new port differs from the stored one.

Common situations: Two services configured with the same host port; leftover container from a previous deployment still holding the port; port changed to one already used by a reverse proxy or database.

Related errors


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