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 malformedCommon 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
- Open the named entry and close any unbalanced brackets or quotes.
- Use ** for recursive directory matches and ! for negation within paths.
- 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
GitHub Actions fromJSON Errors - Invalid JSON in a Dynamic MatrixFix GitHub Actions fromJSON failures - passing a non-JSON string, an empty output, or unquoted output to from…
GitHub Actions "Unexpected value 'X'" - Wrong Scalar in a Mapping KeyFix GitHub Actions "Unexpected value `X`" - a scalar supplied where a mapping or list is expected, or a value…
GitHub Actions "No event triggers defined in 'on'"Fix GitHub Actions "No event triggers defined in `on`" - an empty, null, or malformed on: block means the wor…