Skip to content
Latchkey

GitHub Actions "Invalid pattern" in a paths / branches Filter

A filter pattern is not a legal glob. An empty entry, a stray character, or an unsupported construct in paths/branches/tags makes the workflow invalid.

What this error means

The workflow is invalid with "Invalid pattern 'x'", naming the bad entry in a paths, paths-ignore, branches, or tags filter.

Actions annotation
Invalid workflow file: .github/workflows/ci.yml
Invalid pattern '[src': the pattern is malformed

Common causes

Malformed or empty glob entry

An unclosed character class, an empty string in the list, or a stray quote produces an invalid pattern the filter cannot compile.

Unsupported glob construct

Filter globs support *, **, ?, +, !, and character ranges. Using a construct outside the supported set (or escaping wrong) is rejected.

How to fix it

Use valid filter glob syntax

Write well-formed patterns with supported wildcards, and quote entries that start with special characters.

.github/workflows/ci.yml
on:
  push:
    paths:
      - 'src/**'
      - '!src/**/*.md'
    branches:
      - 'release/**'

Fix the named pattern

  1. Open the named entry and close any unbalanced brackets or quotes.
  2. Use ** for recursive directory matches and ! for negation within paths.
  3. Remove blank list items that resolve to an empty pattern.

How to prevent it

  • Quote patterns beginning with special characters.
  • Stick to supported glob wildcards (*, **, ?, +, !, ranges).
  • Validate filters with actionlint before pushing.

Related guides

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