Skip to content

Propagate fatal error from Link query in FDS#722

Merged
stefanvanburen merged 1 commit intomainfrom
svanburen/fds-propagate-fatal-from-link
Apr 29, 2026
Merged

Propagate fatal error from Link query in FDS#722
stefanvanburen merged 1 commit intomainfrom
svanburen/fds-propagate-fatal-from-link

Conversation

@stefanvanburen
Copy link
Copy Markdown
Contributor

FDS.Execute was not checking linkResult[0].Fatal before iterating over IR files. When Link.Execute fails fatally (e.g. due to a file-open error like DuplicateProtoPathError), its result value is nil, so FDS silently produced an empty FileDescriptorSet with no fatal error instead of propagating the underlying error to callers.

Add the same guard used elsewhere in this package — identical to the check in IR.Execute after its AST sub-query (ir.go:62-64), and to the fdpResults check already present later in FDS.Execute itself.

`FDS.Execute` was not checking `linkResult[0].Fatal` before iterating over IR
files. When `Link.Execute` fails fatally (e.g. due to a file-open error like
`DuplicateProtoPathError`), its result value is nil, so FDS silently produced
an empty `FileDescriptorSet` with no fatal error instead of propagating the
underlying error to callers.

Add the same guard used elsewhere in this package — identical to the check
in `IR.Execute` after its `AST` sub-query (`ir.go:62-64`), and to the
`fdpResults` check already present later in `FDS.Execute` itself.
stefanvanburen added a commit to bufbuild/buf that referenced this pull request Apr 28, 2026
When a proto file is contained in multiple modules (DuplicateProtoPathError),
the new experimental compiler was silently swallowing the typed error: FDS
did not check the fatal error from its Link sub-query, producing an empty
FileDescriptorSet instead of propagating the error upward. This meant callers
of compileImage could not inspect it via errors.As, and the downstream
"nil FileDescriptor" panic was unhelpful.

The fix is in protocompile (bufbuild/protocompile#722): FDS.Execute now
checks linkResult[0].Fatal before iterating over IR files, propagating the
Link fatal as its own. With this, results[0].Fatal in compileImage is
DuplicateProtoPathError, which is returned directly so callers retain its
type information and the existing "Failure: " / exit code 1 behavior is
preserved.
@stefanvanburen stefanvanburen merged commit ff9ca39 into main Apr 29, 2026
11 checks passed
@stefanvanburen stefanvanburen deleted the svanburen/fds-propagate-fatal-from-link branch April 29, 2026 14:17
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.

2 participants