Skip to content

Report Theme Check config directories as expected errors - #8988

Merged
isaacroldan merged 1 commit into
mainfrom
theme-check-config-directory-error
Oct 23, 2026
Merged

isaacroldan merged 1 commit into
mainfrom
theme-check-config-directory-error

Conversation

@MillanWangShopify

@MillanWangShopify MillanWangShopify commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

WHY are these changes introduced?

Closes https://github.com/shop/issues/issues/100399
Vault issue: https://vault.shopify.io/teams/16949-Dev-Experience/issues/92571-error-eisdir-illegal-operation-on-a-directory-read

shopify theme check -C . (or --config <dir>, with --print and --list too) crashes with EISDIR: illegal operation on a directory, read. Theme Check reads the config with readFile, and the failure is reported as an unhandled CLI error. Many CLIs use -C <dir> to mean "run in this directory", but here -C is the config file, and --path sets the theme folder.

WHAT is this pull request doing?

  • Before loading, checks whether the explicitly selected config is a directory, and raises an AbortError with a next step for check, --print and --list. It checks up front because the EISDIR that readFile raises often has no path, so it can't be matched after the failure like the existing missing-file case.
  • Resolves symlinks first (fileRealPath), because cli-kit's isDirectory uses lstat, so a symlink to a directory is caught too.
  • Skips theme-check-node's ModernIdentifiers and missing paths, so missing files still produce "Theme Check config file not found".
  • Makes the --config flag description say it takes a file path and that --path sets the theme directory.

Known limitation, to fix in Shopify/theme-tools: a directory named .theme-check.yml in the theme root (discovery only uses fs.stat), and extends: entries that point to a directory, still crash. Both need a theme-check-node release.

Before:

╭─ error ─╮  EISDIR: illegal operation on a directory, read

After:

Theme Check config must be a file, but . is a directory.
Pass the path to a .theme-check.yml file to --config, or omit --config to use the .theme-check.yml in your theme root. To choose the theme directory, use --path.

How to manually test your changes?

cd <any theme directory>
pnpm shopify theme check -C .
pnpm shopify theme check --config . --print
pnpm shopify theme check --config theme-check:recommended
pnpm shopify theme check --config ./missing.yml

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes
  • I've considered analytics changes to measure impact
  • The change is user-facing — I've identified the correct bump type (patch for bug fixes · minor for new features · major for breaking changes) and added a changeset with pnpm changeset add

@MillanWangShopify
MillanWangShopify added this pull request to stack #8990 October 22, 2026 16:04
@github-actions github-actions Bot added the Area: @shopify/theme @shopify/theme package issues label Oct 22, 2026
@MillanWangShopify
MillanWangShopify marked this pull request as ready for review October 22, 2026 16:07
@MillanWangShopify
MillanWangShopify requested review from a team as code owners October 22, 2026 16:07
Check up front whether the explicitly selected Theme Check config is a directory, including through a symlink, and raise an AbortError for check, --print, and --list instead of crashing with EISDIR. The EISDIR raised by readFile often has no path, so it can't be matched after the failure like the missing-file case.

Clarify in the --config flag description that it takes a file path and that --path sets the theme directory.

Closes shop/issues#100399
@MillanWangShopify
MillanWangShopify force-pushed the theme-check-config-directory-error branch from 5505e58 to 87cc186 Compare October 22, 2026 17:41

@karreiro karreiro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @MillanWangShopify!

@isaacroldan
isaacroldan added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 1c7a199 Oct 23, 2026
43 of 53 checks passed
@isaacroldan
isaacroldan deleted the theme-check-config-directory-error branch October 23, 2026 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: @shopify/theme @shopify/theme package issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants