Skip to content

fix: resolve tsconfig.json via realpath to avoid bun fd mismatch#1239

Open
richkuo wants to merge 1 commit intoanthropics:mainfrom
richkuo:fix/bun-tsconfig-realpath
Open

fix: resolve tsconfig.json via realpath to avoid bun fd mismatch#1239
richkuo wants to merge 1 commit intoanthropics:mainfrom
richkuo:fix/bun-tsconfig-realpath

Conversation

@richkuo
Copy link
Copy Markdown

@richkuo richkuo commented Apr 20, 2026

Summary

Fixes the Bun Internal error: directory mismatch for directory ".../tsconfig.json", fd N reported in #1234 by resolving the tsconfig path with realpath before passing it to --tsconfig-override.

Root cause

GitHub-hosted runners place actions at paths like /home/runner/work/_actions/<owner>/<action>/<ref>/, where <ref> (e.g. v1) is typically a symlink to the actual SHA-named directory. When ${GITHUB_ACTION_PATH}/tsconfig.json is passed to bun as-is, bun opens the file via the symlinked path but stores fd metadata keyed by the canonicalized path. On subsequent lookups bun sees a path mismatch and logs the internal error.

Pre-resolving with realpath gives bun a canonical path up front, so the fd's stored path and the lookup path agree.

Changes

  • action.yml: wrap each of the 3 occurrences of --tsconfig-override="${GITHUB_ACTION_PATH}/tsconfig.json" with $(realpath ...).

realpath is part of coreutils and is always available on ubuntu-latest runners.

Test plan

  • Trigger @claude on a PR with the patched action ref and confirm the bun internal error no longer appears in logs.
  • Verify the action still functions correctly (tsconfig resolution still works for bun's TypeScript execution).

Closes #1234


Generated with: Claude Opus 4.7 (1M) | Effort: medium

GitHub-hosted runners place actions at symlinked paths under
_actions/<owner>/<action>/<ref>/. When GITHUB_ACTION_PATH is passed
directly to --tsconfig-override, bun's internal file descriptor
tracking reports "Internal error: directory mismatch for directory
.../tsconfig.json, fd N" because the path bun re-resolves after
opening the fd differs from the original path (due to the symlink).

Resolving the tsconfig path with realpath before passing it to bun
gives bun a canonical path from the start, eliminating the mismatch.

Closes anthropics#1234
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bun: Internal error 'directory mismatch for directory' in v1 action on GitHub-hosted runners

1 participant