Skip to content
Latchkey

GitHub Actions "Invalid pattern" in paths / paths-filter

The paths and paths-ignore filters use a restricted glob syntax. Unsupported tokens, a leading negation in the wrong place, or invalid characters cause an Invalid pattern error.

What this error means

The workflow fails to evaluate its path filter, reporting an invalid pattern after a problematic glob in paths or paths-ignore.

github-actions
Invalid workflow file: .github/workflows/ci.yml
Invalid pattern '**.{js,ts}': the pattern is not valid.

Common causes

Unsupported glob construct

Brace expansion or other shell-glob features not supported by the filter syntax fail.

Misplaced negation

A ! negation used incorrectly within the pattern set is rejected.

How to fix it

Use supported glob syntax

  1. Replace brace expansion with separate entries (one per extension).
  2. Use ** for recursive matches and * for single segments.
  3. List negations as separate paths-ignore entries where appropriate.
.github/workflows/ci.yml
on:
  push:
    paths:
      - '**/*.js'
      - '**/*.ts'

How to prevent it

  • Stick to the documented paths glob subset; avoid shell-only constructs.
  • Test path filters on a branch with representative file changes.

Related guides

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