{"record":{"id":"e8ac4acf8626d28b","repo":"Dokploy/dokploy","slug":"unauthorized","errorCode":"UNAUTHORIZED","errorMessage":"Feature disabled on cloud","messagePattern":"Feature disabled on cloud","errorType":"http","errorClass":"TRPCError","httpStatus":401,"severity":"error","filePath":"apps/dokploy/server/api/routers/admin.ts","lineNumber":17,"sourceCode":"import {\n\tgetWebServerSettings,\n\tIS_CLOUD,\n\tsetupWebMonitoring,\n\tupdateWebServerSettings,\n} from \"@dokploy/server\";\nimport { TRPCError } from \"@trpc/server\";\nimport { apiUpdateWebServerMonitoring } from \"@/server/db/schema\";\nimport { adminProcedure, createTRPCRouter } from \"../trpc\";\n\nexport const adminRouter = createTRPCRouter({\n\tsetupMonitoring: adminProcedure\n\t\t.input(apiUpdateWebServerMonitoring)\n\t\t.mutation(async ({ input }) => {\n\t\t\ttry {\n\t\t\t\tif (IS_CLOUD) {\n\t\t\t\t\tthrow new TRPCError({\n\t\t\t\t\t\tcode: \"UNAUTHORIZED\",\n\t\t\t\t\t\tmessage: \"Feature disabled on cloud\",\n\t\t\t\t\t});\n\t\t\t\t}\n\n\t\t\t\tawait updateWebServerSettings({\n\t\t\t\t\tmetricsConfig: {\n\t\t\t\t\t\tserver: {\n\t\t\t\t\t\t\ttype: \"Dokploy\",\n\t\t\t\t\t\t\trefreshRate: input.metricsConfig.server.refreshRate,\n\t\t\t\t\t\t\tport: input.metricsConfig.server.port,\n\t\t\t\t\t\t\ttoken: input.metricsConfig.server.token,\n\t\t\t\t\t\t\tcronJob: input.metricsConfig.server.cronJob,\n\t\t\t\t\t\t\turlCallback: input.metricsConfig.server.urlCallback,\n\t\t\t\t\t\t\tretentionDays: input.metricsConfig.server.retentionDays,\n\t\t\t\t\t\t\tthresholds: {\n\t\t\t\t\t\t\t\tcpu: input.metricsConfig.server.thresholds.cpu,\n\t\t\t\t\t\t\t\tmemory: input.metricsConfig.server.thresholds.memory,","sourceCodeStart":1,"sourceCodeEnd":35,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/apps/dokploy/server/api/routers/admin.ts#L1-L35","documentation":"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.","triggerScenarios":"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.","commonSituations":"Drift between the application database and Docker state after manual cleanup; environment rebuilds where networks are wiped but DB rows persist.","solutions":["Verify the network exists: docker network ls | grep <name>","If the network is gone, remove or recreate the DB row so state converges","Confirm the remote daemon (row.serverId) is reachable if the network lives on another server","Catch and treat 404 statusCode as 'missing' rather than a hard failure"],"exampleFix":"// before\nconst info = await inspectNetwork(row);\n// after\ntry {\n  const info = await inspectNetwork(row);\n} catch (e) {\n  if ((e as { statusCode?: number })?.statusCode === 404) {\n    // reconcile: recreate or delete the DB row\n  }\n}","handlingStrategy":"try-catch","validationCode":"const docker = await getRemoteDocker(row.serverId ?? null);\nconst nets = await docker.listNetworks({ name: row.name });\nif (nets.length === 0) { /* network missing; reconcile row */ }","typeGuard":"const hasStatusCode = (e: unknown): e is { statusCode: number } =>\n  typeof e === 'object' && e !== null && 'statusCode' in e;","tryCatchPattern":"try { return await inspectNetwork(row); } catch (e) { if (hasStatusCode(e) && e.statusCode === 404) return null; throw e; }","preventionTips":["Reconcile DB rows after manual docker network rm","Treat 404 inspect as 'missing', not fatal","Verify remote daemon connectivity when serverId is set"],"tags":["docker","network","trpc","inspect"],"backgroundTag":"docker-network-not-found","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}