Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

generate:types (and other bin commands) hang forever with 100% CPU when tsconfig has a relative rootDir like "./"

Open
#18,324 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
node.js, typescript
Domain
backend, cli

Research direction

Start with getTSConfigPaths() in packages/payload/src/config/find.ts and the findUpSync implementation in packages/payload/src/utilities/findUp.ts. Reproduce the hang with the linked setup or the listed tsconfig changes, then verify that pnpm payload generate:types no longer loops and either generates types or reports that the config cannot be found.

Written by the indexing model from the issue text.

Description

area: core Bug status: needs-triage v3
Describe the Bug

When PAYLOAD_CONFIG_PATH is not set and tsconfig.json has no "@payload-config" path, payload generate:types hangs indefinitely at 100% CPU with no output.

Cause: in getTSConfigPaths() (packages/payload/src/config/find.ts), srcPath is taken directly from compilerOptions.rootDir without being resolved to an absolute path:

const srcPath = tsConfig.compilerOptions?.rootDir || path.resolve(process.cwd(), 'src')

With "rootDir": "./", findUpSync({ dir: './' }) loops forever:

  • path.parse('./').root === ''
  • path.dirname('./') === '.', and path.dirname('.') === '.'
  • so dir never equals root and the while(true) loop never exits.

Suggested fix: resolve rootDir (and outDir) relative to the tsconfig directory, e.g.
path.resolve(tsConfigDir, tsConfig.compilerOptions.rootDir)
Optionally, findUpSync/findUp could also guard against dirname(dir) === dir.

Workaround: set PAYLOAD_CONFIG_PATH, or add "paths": { "@payload-config": ["./path/to/payload.config.ts"] } to tsconfig.json.

Link to the code that reproduces this issue

https://github.com/bbkysf/payload-rootdir-hang

Reproduction Steps
  1. pnpx create-payload-app@latest -t blank repro && cd repro
  2. Move src/payload.config.ts to dev/payload.config.ts (fix its relative imports)
  3. In tsconfig.json:
    • remove "@payload-config" from compilerOptions.paths
    • set "rootDir": "./"
  4. Run pnpm payload generate:types

Expected: types are generated, or an error says the config can't be found.
Actual: the process hangs forever with no output at 100% CPU (one core pinned). It never exits.

findUpSync({ dir: './' }) in packages/payload/src/utilities/findUp.ts loops forever because path.dirname('.') === '.' and path.parse('./').root === '', so dir !== root is always true.

Setting PAYLOAD_CONFIG_PATH, or adding the @payload-config path back, avoids the hang.

Which area(s) are affected?

area: core

Environment Info
Binaries:
  Node: 24.18.0
  pnpm: 11.20.0
Relevant Packages:
  payload: 3.90.0
  next: 16.3.3
  @payloadcms/db-postgres: 3.90.0
  @payloadcms/next: 3.90.0
  @payloadcms/richtext-lexical: 3.90.0
  react: 19.2.6
Operating System:
  Debian GNU/Linux 13 (trixie) on WSL2 (kernel 6.18.33.2-microsoft-standard-WSL2), Windows 11
  x64, 8 cores
Dominant language
TypeScript
Stars
45.5k
Forks
4.3k
Avg merge
1d 19h
Merged PRs (30d)
309

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from payloadcms/payload

All issues in payloadcms/payload

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.