Index: app/(app)/add/actions.ts
===================================================================
--- app/(app)/add/actions.ts	(revision 95953b25a807e0a7c0d989529f8d1a97350fdea2)
+++ app/(app)/add/actions.ts	(revision b04ba1e157677d8749211da255f2549e103aec19)
@@ -76,15 +76,21 @@
     }
 
-    // Check duplicate (case-insensitive)
-    const existing = await sql`
-        SELECT tag_id FROM tag WHERE LOWER(tag_name) = ${name}
-    `;
-    if (existing.length > 0) {
-        return { error: `Tag "${name}" already exists.` };
-    }
-
-    try {
-        await sql`INSERT INTO tag (tag_name) VALUES (${name})`;
-    } catch {
+    try {
+        // eslint-disable-next-line @typescript-eslint/no-explicit-any
+        await sql.begin(async (tx: any) => {
+            // Check duplicate (case-insensitive)
+            const existing = await tx`
+                SELECT tag_id FROM tag WHERE LOWER(tag_name) = ${name}
+            `;
+            if (existing.length > 0) {
+                throw new Error(`Tag "${name}" already exists.`);
+            }
+
+            await tx`INSERT INTO tag (tag_name) VALUES (${name})`;
+        });
+    } catch (e: any) {
+        if (e instanceof Error && e.message.includes('already exists')) {
+            return { error: e.message };
+        }
         return { error: 'Failed to create tag.' };
     }
Index: app/(app)/profile/actions.ts
===================================================================
--- app/(app)/profile/actions.ts	(revision 95953b25a807e0a7c0d989529f8d1a97350fdea2)
+++ app/(app)/profile/actions.ts	(revision b04ba1e157677d8749211da255f2549e103aec19)
@@ -31,19 +31,29 @@
     }
 
-    // Email already exists check
-    const existing = await sql`
-        SELECT user_id FROM "user"
-        WHERE email = ${email} AND user_id != ${userId}
-    `;
-    if (existing.length > 0) {
-        return 'Email already exists.';
+    try {
+        // eslint-disable-next-line @typescript-eslint/no-explicit-any
+        await sql.begin(async (tx: any) => {
+            // Email already exists check
+            const existing = await tx`
+                SELECT user_id FROM "user"
+                WHERE email = ${email} AND user_id != ${userId}
+            `;
+            if (existing.length > 0) {
+                throw new Error('Email already exists.');
+            }
+
+            await tx`
+                UPDATE "user"
+                SET user_name = ${name},
+                    email = ${email}
+                WHERE user_id = ${userId}
+            `;
+        });
+    } catch (e: any) {
+        if (e instanceof Error && e.message === 'Email already exists.') {
+            return e.message;
+        }
+        throw e;
     }
-
-    await sql`
-        UPDATE "user"
-        SET user_name = ${name},
-            email = ${email}
-        WHERE user_id = ${userId}
-    `;
 
     redirect('/profile');
Index: app/(auth)/actions.ts
===================================================================
--- app/(auth)/actions.ts	(revision 95953b25a807e0a7c0d989529f8d1a97350fdea2)
+++ app/(auth)/actions.ts	(revision b04ba1e157677d8749211da255f2549e103aec19)
@@ -62,19 +62,24 @@
         redirectTo?.startsWith('/') ? redirectTo : '/dashboard';
 
-    const existing =
-        await sql`SELECT user_id FROM "user" WHERE email=${email}`;
-
-    if (existing.length > 0) {
-        return 'User already exists.';
-    }
-
     const hashed = await bcrypt.hash(password, 10);
 
     try {
-        await sql`
-            INSERT INTO "user" (user_name, email, password)
-            VALUES (${user_name}, ${email}, ${hashed})
-        `;
-    } catch {
+        // eslint-disable-next-line @typescript-eslint/no-explicit-any
+        await sql.begin(async (tx: any) => {
+            const existing = await tx`SELECT user_id FROM "user" WHERE email=${email}`;
+
+            if (existing.length > 0) {
+                throw new Error('User already exists.');
+            }
+
+            await tx`
+                INSERT INTO "user" (user_name, email, password)
+                VALUES (${user_name}, ${email}, ${hashed})
+            `;
+        });
+    } catch (e: any) {
+        if (e instanceof Error && e.message === 'User already exists.') {
+            return e.message;
+        }
         return 'Failed to create user.';
     }
