Skip to content

Use toUriString for paths in work-dir and FilesEx error messages#7075

Merged
pditommaso merged 1 commit intomasterfrom
improve-workdir-error-messages
Apr 25, 2026
Merged

Use toUriString for paths in work-dir and FilesEx error messages#7075
pditommaso merged 1 commit intomasterfrom
improve-workdir-error-messages

Conversation

@pditommaso
Copy link
Copy Markdown
Member

Summary

Paths backed by non-default filesystems (S3, Azure Blob, etc.) render as opaque provider objects when interpolated directly into a GString, producing unhelpful messages like Cannot get read permission on file: nextflow.file.http.XPath@....

Wrap the offending paths with toUriString(...) in:

  • Session.init — the "Cannot create work-dir" abort message now shows the work-dir URI.
  • FilesEx — the mkdirs/canRead/canWrite/canExecute/lastModified debug/trace logs now include a usable URI.

Also splits the long single-line if(!workDir.mkdirs()) throw ... in Session.init onto two lines for readability.

Test plan

  • ./gradlew :nextflow:compileGroovy :nf-commons:compileGroovy passes
  • Trigger a non-writable work-dir and confirm the error message shows the URI

Paths backed by non-default filesystems (e.g. S3, Azure) render as
opaque provider objects when interpolated directly into a GString.
Wrap them with toUriString so diagnostic messages show a usable
URI in the work-dir abort and in FilesEx permission/modify-time
failure logs.

Signed-off-by: Paolo Di Tommaso <paolo.ditommaso@gmail.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 24, 2026

Deploy Preview for nextflow-docs-staging canceled.

Name Link
🔨 Latest commit f519e56
🔍 Latest deploy log https://app.netlify.com/projects/nextflow-docs-staging/deploys/69ebdae8b0887c000853df51

@pditommaso pditommaso requested a review from bentsherman April 24, 2026 21:07
@pditommaso pditommaso merged commit b535377 into master Apr 25, 2026
24 of 25 checks passed
@pditommaso pditommaso deleted the improve-workdir-error-messages branch April 25, 2026 09:59

if(!workDir.mkdirs()) throw new AbortOperationException("Cannot create work-dir: $workDir -- Make sure you have write permissions or specify a different directory by using the `-w` command line option")
if(!workDir.mkdirs())
throw new AbortOperationException("Cannot create work-dir '${FilesEx.toUriString(workDir)}' -- Make sure you have write permissions or specify a different directory by using the `-w` command line option")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Nit, you should be able to use workDir.toUriString() here and eliminate the extra import

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