{"record":{"id":"0fe7600d08236c45","repo":"Dokploy/dokploy","slug":"internal-server-error-0fe760","errorCode":"INTERNAL_SERVER_ERROR","errorMessage":"Failed to move compose","messagePattern":"Failed to move compose","errorType":"exception","errorClass":"TRPCError","httpStatus":500,"severity":"error","filePath":"apps/dokploy/server/api/routers/compose.ts","lineNumber":790,"sourceCode":"\t\t\t\ttargetEnvironmentId: z.string(),\n\t\t\t}),\n\t\t)\n\t\t.mutation(async ({ input, ctx }) => {\n\t\t\tawait checkServicePermissionAndAccess(ctx, input.composeId, {\n\t\t\t\tservice: [\"create\"],\n\t\t\t});\n\n\t\t\tconst updatedCompose = await db\n\t\t\t\t.update(composeTable)\n\t\t\t\t.set({\n\t\t\t\t\tenvironmentId: input.targetEnvironmentId,\n\t\t\t\t})\n\t\t\t\t.where(eq(composeTable.composeId, input.composeId))\n\t\t\t\t.returning()\n\t\t\t\t.then((res) => res[0]);\n\n\t\t\tif (!updatedCompose) {\n\t\t\t\tthrow new TRPCError({\n\t\t\t\t\tcode: \"INTERNAL_SERVER_ERROR\",\n\t\t\t\t\tmessage: \"Failed to move compose\",\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tawait audit(ctx, {\n\t\t\t\taction: \"update\",\n\t\t\t\tresourceType: \"compose\",\n\t\t\t\tresourceId: input.composeId,\n\t\t\t\tresourceName: updatedCompose.name,\n\t\t\t});\n\t\t\treturn updatedCompose;\n\t\t}),\n\n\tprocessTemplate: protectedProcedure\n\t\t.input(\n\t\t\tz.object({\n\t\t\t\tbase64: z.string(),","sourceCodeStart":772,"sourceCodeEnd":808,"githubUrl":"https://github.com/Dokploy/dokploy/blob/546686ea3587f12ec5652217dedd9f7960fb6d15/apps/dokploy/server/api/routers/compose.ts#L772-L808","documentation":"Thrown by the moveCompose tRPC mutation when the Drizzle update()...returning() query for composeTable does not return a row. Returning() normally fails loudly; an empty result means the WHERE clause (composeId) matched no row after the update executed.","triggerScenarios":"Calling moveCompose with a composeId that does not exist in the compose table, or that was concurrently deleted between authorization and the update.","commonSituations":"Stale UI holding a deleted compose's ID; race with a simultaneous delete; passing an ID from a different environment/database.","solutions":["Verify the composeId exists (findComposeById) before calling moveCompose","Refresh the client state/refetch composes after deletions","Wrap the call and treat empty result as NOT_FOUND rather than retrying"],"exampleFix":"// before\nawait api.compose.moveCompose({ composeId, serverId });\n// after\nconst compose = await api.compose.get.byComposeId({ composeId });\nif (!compose) throw new Error('Compose no longer exists');\nawait api.compose.moveCompose({ composeId, serverId });","handlingStrategy":"validation","validationCode":"const compose = await findComposeById(composeId);\nif (!compose) throw new Error('Compose not found');","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Refetch compose list after delete operations","Pass fresh IDs from current query results"],"tags":["dokploy","compose","drizzle","database"],"backgroundTag":"row-not-found-update","analyzedSha":"546686ea3587f12ec5652217dedd9f7960fb6d15","analyzedAt":"2026-08-27T05:18:58.095Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}