Skip to content

fix(core): suppress git stderr output in parseGitOutput - #33645

Merged
FrozenPandaz merged 2 commits into
masterfrom
fix/git-stderr-output
Nov 28, 2025
Merged

fix(core): suppress git stderr output in parseGitOutput#33645
FrozenPandaz merged 2 commits into
masterfrom
fix/git-stderr-output

Conversation

@FrozenPandaz

Copy link
Copy Markdown
Contributor

Current Behavior

Since Nx 21.6.1, running nx graph or other commands that calculate affected projects prints git errors to stderr when the default branch is not fetched:

fatal: ambiguous argument 'main': unknown revision or path not in the working tree.

This causes CI pipelines with strict stderr checking to fail, even though the nx commands succeed.

Expected Behavior

Git error messages should not be printed to stderr. The errors are already caught and handled gracefully - they just shouldn't be visible to the user.

Related Issue(s)

Fixes #33330

Solution

Added stdio: 'pipe' to the execSync call in parseGitOutput(). This suppresses stderr output while still allowing the command to throw on failure (which is already caught by the try-catch in graph.ts).

This matches the pattern used in getMergeBase() which already uses stdio: 'pipe'.

The parseGitOutput function was missing `stdio: 'pipe'` option, causing git error messages to be printed directly to stderr. This caused CI pipelines with strict error checking to fail even when nx commands succeeded.

Fixes #33330
@FrozenPandaz
FrozenPandaz requested a review from a team as a code owner November 27, 2025 21:09
@vercel

vercel Bot commented Nov 27, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Updated (UTC)
nx-dev Ready Ready Preview Nov 28, 2025 2:41pm
@netlify

netlify Bot commented Nov 27, 2025

Copy link
Copy Markdown

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 542a229
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/6929b368bc69df000802e381
😎 Deploy Preview https://deploy-preview-33645--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud

nx-cloud Bot commented Nov 27, 2025

Copy link
Copy Markdown
Contributor

View your CI Pipeline Execution ↗ for commit 542a229

Command Status Duration Result
nx affected --targets=lint,test,test-kt,build,e... ✅ Succeeded 11m 6s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 1m 46s View ↗
nx-cloud record -- nx-cloud conformance:check ✅ Succeeded 11s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2025-11-28 14:52:27 UTC

@nx-cloud nx-cloud Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

A new CI pipeline execution was requested that may update the conclusion below...

Nx Cloud has identified a possible root cause for your failed CI:

Our test failures are unrelated to the stderr suppression changes. The e2e test failed due to an npm registry issue ("get-proto is not in the npm registry"), and the workspace test failed on Nuxt file generation. Neither failure involves the modified git output parsing code, and the npm registry issue requires external service recovery.

No code changes were suggested for this issue.

Nx Cloud View detailed reasoning on Nx Cloud ↗


🎓 Learn more about Self-Healing CI on nx.dev

@FrozenPandaz
FrozenPandaz merged commit 3ca0e47 into master Nov 28, 2025
19 checks passed
@FrozenPandaz
FrozenPandaz deleted the fix/git-stderr-output branch November 28, 2025 14:52
@github-actions

github-actions Bot commented Dec 4, 2025

Copy link
Copy Markdown
Contributor

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Dec 4, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

2 participants