Skip to content
Latchkey

Storybook "No story files found for the specified pattern" in CI

Storybook expanded the stories globs in .storybook/main and found zero matching files. The build then fails because there is nothing to compile, usually due to a wrong path, extension, or case mismatch.

What this error means

The build stops with "No story files found for the specified pattern: src/**/*.stories.@(js|jsx|ts|tsx)" even though stories exist locally.

storybook
=> Failed to build the preview
No story files found for the specified pattern: src/**/*.stories.@(js|jsx|mdx|ts|tsx)

Common causes

The glob does not match the actual paths

The stories pattern points at a directory or extension that does not exist in the checkout, so the expansion returns nothing.

Case-sensitive filesystem on the runner

Linux runners are case-sensitive, so a story named Button.Stories.tsx will not match a *.stories.tsx glob that builds fine on a case-insensitive local disk.

How to fix it

Point the glob at the real story locations

  1. List the actual story paths and extensions in the repo.
  2. Update the stories array in .storybook/main to match them exactly, including case.
  3. Re-run the build to confirm files are discovered.
.storybook/main.js
// .storybook/main.js
export default {
  stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
};

Normalize story filename casing

Rename files so the extension case matches the glob, since CI runs on a case-sensitive filesystem.

How to prevent it

  • Keep the stories globs relative to .storybook and aligned with real paths.
  • Use consistent lowercase .stories. extensions so case-sensitive runners match.
  • Build Storybook in CI so an empty glob fails the PR, not production.

Related guides

Tired of flaky CI? Latchkey auto-heals failed jobs and retries them for you. Start free →