Fix TraceFileObserver NPE when trace file already exists#6891
Merged
bentsherman merged 4 commits intomasterfrom Mar 17, 2026
Merged
Fix TraceFileObserver NPE when trace file already exists#6891bentsherman merged 4 commits intomasterfrom
bentsherman merged 4 commits intomasterfrom
Conversation
When TraceHelper.newFileWriter() throws in onFlowCreate() (e.g. trace file already exists on S3 without overwrite enabled), the writer Agent is left null. Every subsequent onTaskComplete, onTaskCached, and onFlowComplete call then throws a NullPointerException, spamming the log with stack traces for every task in the run. Catch the exception in onFlowCreate and log at warn level so the user sees the actionable message, return early, and add null-safe guards on writer at the remaining call sites so the observer degrades gracefully. Closes #6890 Signed-off-by: Rob Syme <rob.syme@gmail.com>
✅ Deploy Preview for nextflow-docs-staging ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
pditommaso
reviewed
Mar 5, 2026
…ver.groovy Co-authored-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com> Signed-off-by: Robert Syme <rob.syme@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NullPointerExceptionspam inTraceFileObserverwhen trace file already exists andoverwriteis not enabledlog.warnso users see the actionable "enable trace.overwrite" message instead of silent failureCloses #6890
Problem
When
TraceHelper.newFileWriter()throws inonFlowCreate()(e.g. trace file already exists on S3), thewriterAgent is never initialized. Every subsequent call toonTaskComplete(),onTaskCached(), andonFlowComplete()then throws:The original
AbortOperationExceptionwith the helpful user-facing message is swallowed atlog.debugbySession.notifyEvent(), so users never see why their trace file wasn't written.Changes
TraceFileObserver.groovy:onFlowCreate()with try-catch; log atwarnlevel (user-visible) anddebuglevel (full stack trace), then return early?.null-safe guards onwriterinonFlowComplete(),onTaskComplete(),onTaskCached()traceFileaccess inonFlowComplete()withif( traceFile )TraceFileObserverTest.groovy:'should degrade gracefully when trace file already exists'— verifies that when file creation fails, all task events and flow completion proceed without exceptions, and the original file is untouched