Skip to content

fix: propagate Maven error detail instead of hardcoded message [CSENG…#219

Open
neema-beglou-snyk wants to merge 1 commit into
masterfrom
fix/cseng-202/propagate-error
Open

fix: propagate Maven error detail instead of hardcoded message [CSENG…#219
neema-beglou-snyk wants to merge 1 commit into
masterfrom
fix/cseng-202/propagate-error

Conversation

@neema-beglou-snyk

Copy link
Copy Markdown
  • Ready for review
  • Follows CONTRIBUTING rules
  • Reviewed by Snyk internal team

What does this PR do?

Propagates the original Maven error detail (file path, line number, column, syntax error description) through UnableToParseXMLError and FailedToBuildMavenProjectError instead of discarding it and substituting hardcoded strings.

Where should the reviewer start?

lib/maven/dependency-tree.ts — the catch block in executeMavenDependencyTree.

How should this be manually tested?

Run snyk sbom --format=cyclonedx1.5+json against a project with a malformed pom.xml (e.g. a missing > on a closing tag). The error output should now include the specific Maven parse error with line/column info rather than just "Error parsing the XML file".

Any background context you want to provide?

Commit e6918d9 (PR #214, v4.6.1) replaced DependencyTreeError with error catalog types but hardcoded the detail strings, discarding the original Maven stderr/stdout. This caused a regression where users lost actionable diagnostics — the error code changed from SNYK-CLI-0011 (which included full Maven output) to SNYK-OS-MAVEN-0005 (which only showed "Error parsing the XML file" with no location info).

What are the relevant tickets?

CSENG-202

Screenshots

Before (v4.6.1 — hardcoded message):

ERROR   Error parsing the XML file (SNYK-OS-MAVEN-0005)

          Error parsing the XML file

Status:  422 Unprocessable Entity

After (this fix — propagated detail):

ERROR   Error parsing the XML file (SNYK-OS-MAVEN-0005)

          Child process failed with exit code: 1.
          STDOUT:
          [FATAL] Non-parseable POM /path/to/pom.xml: expected > to finish end tag
          not < from line 6 (position: TEXT seen ...) @ line 7, column 6

Additional questions

None.

@neema-beglou-snyk neema-beglou-snyk requested review from a team as code owners May 19, 2026 16:47
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@snyk-io

snyk-io Bot commented May 19, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants