Jobs whose rules cannot be evaluated are silently dropped when alone in their stage
The title and description were updated on 2026-10-30. The original report was about rules:exists:regexp timeouts, but the investigation found that the timeout is one of several errors dropped in the same way. The cause sits in how a stage is filtered, so the fix covers every rule error, and the original title no longer described the scope. The original title was "rules:exists:regexp timeout errors are silently swallowed when the affected job is the only build in its stage". The original description is kept at the end.
Summary
When a job's rules: cannot be evaluated, GitLab records a Clause::ParseError and treats the rule as when: never. If that job is the only one in its stage, the stage is dropped before its errors are collected. The pipeline is created without the job or the stage, and no error is shown anywhere.
This was reported for rules:exists:regexp timeouts, but every clause that raises Clause::ParseError is affected:
rules:exists:regexpover the per-path timeout or the total time budget- an invalid
rules:exists:project - an invalid
rules:exists:ref - an invalid
rules:changes:compare_to
The rules:exists:regexp docs say the pipeline fails with a configuration error. It has behaved this way since 15.3.
https://gitlab.com/oyakovenko-ext/ci-rules-parse-error-swallowed-606330 reproduces it for rules:exists:project, rules:exists:ref, and rules:changes:compare_to. Each case has a control run, where a second job in the stage makes the error show.
Fix
!259103 (merged) (merged in 19.6), behind the ci_create_failed_job_on_rules_parse_error flag, default off. Rollout: #632884 (closed).
With the flag on:
- The job is created as
failedwithallow_failure: trueand the failure reasonrules_parse_failure. It never runs, and the job page shows the exact rules error. - The pipeline still passes, with warnings.
- A job that has a non-optional
needs:on the broken job fails pipeline creation with the rules error. - A pipeline where every job has a rules error is still treated as empty and is not created, as before.
- A stage that keeps at least one other job is unchanged: pipeline creation fails with a configuration error.
The jobs are created as failed instead of failing pipeline creation, because many projects with pipelines that pass today would break. Logging from !257559 (merged) measured this. The results are in an internal note: #606330 (comment 3938328207).
Original description
Summary
When a rules:exists:regexp evaluation hits either the 50 ms per-path timeout (REGEXP_TIMEOUT_SECONDS) or the 2 s total wall-clock budget (REGEXP_TOTAL_TIMEOUT_SECONDS), the raised Clause::ParseError is caught by Rules#evaluate and converted to Result.new(when: 'never', errors: [...]). If the affected job is the only build in its stage, the stage is filtered out of Pipeline#stage_seeds before its errors can be collected, so Chain::Seed sees no errors and creates the pipeline normally without the job. No configuration error is surfaced.
The documentation for rules:exists:regexp states:
If either timeout is exceeded, the pipeline fails with a configuration error.
Actual behaviour on a single-build stage: the pipeline succeeds silently with the job (and stage) absent.
Steps to reproduce
-
Create a project with a
.gitlab-ci.ymlthat has at least one local job in a non-.prestage (so pipelines can be created at all), and includes a CI/CD component (or has an injected Pipeline Execution Policy) whose job lands in a stage on its own. For example, a localdummy_jobindummy_stage, plus an included component that adds a security-scanning job to.pre. -
On that included/injected job, configure
rules:exists:regexpwith a pattern near the timeout boundary. A negative lookahead over.*followed by another.*in the main body is a reliable trigger, for example:rules: - if: $CI_PIPELINE_SOURCE == 'schedule' when: never - if: $CI_PIPELINE_SOURCE == "merge_request_event" || $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH exists: regexp: '\A(?!.*(?:^|/)(?:tmp|node_modules|\.bundle|vendor|\.git)/).*(requirements\.txt|(Pipfile|poetry|uv|yarn)\.lock|package-lock\.json|pnpm-lock\.yaml|build\.gradle|pom\.xml)\z' -
Populate the repository with ~49,998 files in random subdirectories, staying under the
MAX_PATTERN_COMPARISONS = 50_000short-circuit so the regex is actually evaluated. -
Run the pipeline many times against the same commit. A fraction of runs will succeed with the affected job (and its containing stage) silently absent, while the rest include the job as expected. No config error, no banner, no user-visible signal on the "job absent" pipelines.
Example Project
A customer reproduced this on GitLab.com against a component pinned by commit SHA (private project, internal Zendesk ticket #733766 for the confidential detail). Reproduction is reconstructible in a fresh project using the config in step 1 and paths in step 3.
What is the current bug behavior?
Pipeline creation succeeds. The stage that would have contained the timing-out job is absent from the resulting pipeline entirely. No error surface anywhere the user can see.
What is the expected correct behavior?
Per documentation: pipeline creation fails with a configuration error naming the timeout, so the user knows their rule is unusable and can fix or simplify it. At minimum: some user-visible signal that a rule evaluation timed out, even if the pipeline is created.
Relevant logs and/or screenshots
The customer's reproduction produced a pipeline with only its local dummy_stage present:
Pipeline #2679141249 (succeeded)
dummy_stage
dummy_job (passed)Adjacent pipeline runs against the same commit, with the same config, correctly included the injected job:
Pipeline #2679141010 (succeeded)
.pre
glsecurity_cve_dependency_scanner (succeeded)
dummy_stage
dummy_job (passed)No yaml_errors, no config error banner, no warning on either pipeline. The dropped runs are indistinguishable in the UI from pipelines where the rule legitimately did not match.
The internal Gitlab::AppJsonLogger.warn call inside RegexpMatcher does emit 'regexp match timed out' or 'regexp total time budget exceeded' entries at the time of the drop, so the timeout is visible to operators via production_json.log on GitLab.com, but not to the customer.
Output of checks
This bug happens on GitLab.com
Results of GitLab environment info
Expand for output related to GitLab environment info
(For installations with omnibus-gitlab package run and paste the output of: `sudo gitlab-rake gitlab:env:info`) (For installations from source run and paste the output of: `sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)
Results of GitLab application Check
Expand for output related to the GitLab application check
(For installations with omnibus-gitlab package run and paste the output of:
sudo gitlab-rake gitlab:check SANITIZE=true)(For installations from source run and paste the output of:
sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)(we will only investigate if the tests are passing)
Possible fixes
Patch release information for backports
If the bug fix needs to be backported in a patch release to a version under the maintenance policy, please follow the steps on the patch release runbook for GitLab engineers.
Refer to the internal "Release Information" dashboard for information about the next patch release, including the targeted versions, expected release date, and current status.
High-severity bug remediation
To remediate high-severity issues requiring an internal release for single-tenant SaaS instances, refer to the internal release process for engineers.