{"record":{"id":"0544c22ae9b88e50","repo":"Dokploy/dokploy","slug":"not-found-0544c2","errorCode":"NOT_FOUND","errorMessage":"Network not found","messagePattern":"Network not found","errorType":"exception","errorClass":"TRPCError","httpStatus":404,"severity":"error","filePath":"packages/server/src/services/network.ts","lineNumber":195,"sourceCode":"\t\t\t\tname,\n\t\t\t\terror:\n\t\t\t\t\terror instanceof Error ? error.message : \"Failed to inspect network\",\n\t\t\t});\n\t\t}\n\t}\n\n\treturn { imported, errors };\n};\n\nexport const findNetworkById = async (networkId: string) => {\n\tconst [row] = await db\n\t\t.select()\n\t\t.from(network)\n\t\t.where(eq(network.networkId, networkId))\n\t\t.limit(1);\n\n\tif (!row) {\n\t\tthrow new TRPCError({\n\t\t\tcode: \"NOT_FOUND\",\n\t\t\tmessage: \"Network not found\",\n\t\t});\n\t}\n\n\treturn row;\n};\n\nexport const createNetwork = async (\n\tinput: z.infer<typeof apiCreateNetwork>,\n\torganizationId: string,\n) => {\n\tif (IS_CLOUD) {\n\t\tif (!input.serverId) {\n\t\t\tthrow new TRPCError({\n\t\t\t\tcode: \"BAD_REQUEST\",\n\t\t\t\tmessage: \"Server is required\",\n\t\t\t});","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/packages/server/src/services/network.ts#L177-L213","documentation":"findNetworkById selects from the network table by networkId with limit 1; NOT_FOUND when no row matches. This helper backs inspect/remove/update flows, so any operation on a nonexistent network ID fails here first.","triggerScenarios":"Inspecting or deleting a network by an ID that was never imported, was already deleted, or is a docker network name mistaken for the DB networkId.","commonSituations":"Confusing docker's network name/ID with the app's internal networkId (UUID); stale UI state after another user removed the network.","solutions":["List networks via the API and use the returned networkId, not the docker name","Refresh the networks page and retry","If deleted intentionally, no action is needed — remove stale references"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const nets = await listNetworks();\nif (!nets.some(n => n.networkId === networkId)) throw new Error(\"unknown networkId\");","typeGuard":null,"tryCatchPattern":"try { return await findNetworkById(networkId); } catch (e) { if (e instanceof TRPCError && e.code === \"NOT_FOUND\") return null; throw e; }","preventionTips":["Always use the API-issued networkId (UUID), never the docker network name"],"tags":["network","not-found","database"],"backgroundTag":"record-not-found","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}