Dokploy/dokploy · error · TRPCError

UNAUTHORIZED

UNAUTHORIZED

Error message

Feature disabled on cloud

What it means

Thrown when docker.getNetwork(row.name).inspect() fails — almost always because no network with that name exists on the daemon, or the daemon is unreachable. Wrapped as BAD_REQUEST with the Docker error message forwarded.

Source

Thrown at apps/dokploy/server/api/routers/admin.ts:17

import {
	getWebServerSettings,
	IS_CLOUD,
	setupWebMonitoring,
	updateWebServerSettings,
} from "@dokploy/server";
import { TRPCError } from "@trpc/server";
import { apiUpdateWebServerMonitoring } from "@/server/db/schema";
import { adminProcedure, createTRPCRouter } from "../trpc";

export const adminRouter = createTRPCRouter({
	setupMonitoring: adminProcedure
		.input(apiUpdateWebServerMonitoring)
		.mutation(async ({ input }) => {
			try {
				if (IS_CLOUD) {
					throw new TRPCError({
						code: "UNAUTHORIZED",
						message: "Feature disabled on cloud",
					});
				}

				await updateWebServerSettings({
					metricsConfig: {
						server: {
							type: "Dokploy",
							refreshRate: input.metricsConfig.server.refreshRate,
							port: input.metricsConfig.server.port,
							token: input.metricsConfig.server.token,
							cronJob: input.metricsConfig.server.cronJob,
							urlCallback: input.metricsConfig.server.urlCallback,
							retentionDays: input.metricsConfig.server.retentionDays,
							thresholds: {
								cpu: input.metricsConfig.server.thresholds.cpu,
								memory: input.metricsConfig.server.thresholds.memory,

View on GitHub (pinned to 546686ea35)

Solutions

  1. Verify the network exists: docker network ls | grep <name>
  2. If the network is gone, remove or recreate the DB row so state converges
  3. Confirm the remote daemon (row.serverId) is reachable if the network lives on another server
  4. Catch and treat 404 statusCode as 'missing' rather than a hard failure

Example fix

// before
const info = await inspectNetwork(row);
// after
try {
  const info = await inspectNetwork(row);
} catch (e) {
  if ((e as { statusCode?: number })?.statusCode === 404) {
    // reconcile: recreate or delete the DB row
  }
}
Defensive patterns

Strategy: try-catch

Validate before calling

const docker = await getRemoteDocker(row.serverId ?? null);
const nets = await docker.listNetworks({ name: row.name });
if (nets.length === 0) { /* network missing; reconcile row */ }

Type guard

const hasStatusCode = (e: unknown): e is { statusCode: number } =>
  typeof e === 'object' && e !== null && 'statusCode' in e;

Try / catch

try { return await inspectNetwork(row); } catch (e) { if (hasStatusCode(e) && e.statusCode === 404) return null; throw e; }

Prevention

When it happens

Trigger: Calling inspectNetwork for a row whose Docker network was deleted out-of-band (docker network rm, compose down), for a network on a stopped/removed Swarm scope, or when serverId points to a daemon that is down or name resolution differs.

Common situations: Drift between the application database and Docker state after manual cleanup; environment rebuilds where networks are wiped but DB rows persist.

Related errors


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