---
title: "Discussion on \"Race conditions in async code\" | Hashnode"
description: "Discussion on \"Race conditions in async code\". What do you think is wrong with this particular block of code?\nasync function createEntity(name: string) {\n  const existing = await this.userRepo.findOne({ where: { name } });\n  if (existing) throw new ConflictException('Name already exists');\n  awai..."
url: "https://hashnode.com/posts/race-conditions-in-async-code/6934a934f8859af5d62b3a94"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Race conditions in async code](https://blog.alanvarghese.me/race-conditions-in-async-code?utm_source=hashnode&utm_medium=feed)

What do you think is wrong with this particular block of code? async function createEntity(name: string) { const existing = await this.userRepo.findOne({ where: { name } }); if (existing) throw new ConflictException('Name already exists'); awai...

Jul 16, 2025 · 3 min read · blog.alanvarghese.me  
Read the article

-   [#race-condition](https://hashnode.com/tag/race-condition)
-   [#asynchronous-javascript](https://hashnode.com/tag/asynchronous-javascript)
-   [#bugs-and-errors](https://hashnode.com/tag/bugs-and-errors)
-   [#programming](https://hashnode.com/tag/programming)

## Written by

[Alan Varghese](https://hashnode.com/@waterrmalann)

@waterrmalann

  
[View profile](https://hashnode.com/@waterrmalann)

Designer. Developer.

A 20-year-old self-taught software engineer with over 7 years of programming experience. Currently working as an engineering lead at @ELT-Global alongside a talented team of developers. Besides programming, I also love writing which brings me here!

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
