Repository navigation
Description
Follow-up on nf-spawn 0.2.11. Great news first: #41 is fixed — declared inputs now stage correctly, FASTQC ran, the .gz-named input was read fine, and one sample went all the way through to completion. But the run still aborts because the task script nf-spawn materializes breaks nf-core's versions.yml heredoc.
Symptom
After the first FASTQC completes, the Nextflow session aborts:
Task completed > FASTQC (SRR059375_stool); status: COMPLETED; exit: 0
ERROR nextflow.extension.OperatorImpl - @unknown
Session aborted -- Cause: while scanning a simple key
Pipeline completed with errors
while scanning a simple key is a SnakeYAML parse error. The aborting input is the FASTQC task's versions.yml, which came out malformed:
"NFCORE_TAXPROFILER:TAXPROFILER:FASTQC":
fastqc: 0.12.1
END_VERSIONS ← the heredoc terminator leaked INTO the file
(The other two samples were still running and got terminated as collateral — they didn't fail.)
Root cause — .command.sh is indented, so <<- can't find its terminator
The generated .command.sh (shown with sed -n l, $ = EOL):
cat <<-END_VERSIONS > versions.yml$
"NFCORE_TAXPROFILER:TAXPROFILER:FASTQC":$
fastqc: $( fastqc --version | sed '/FastQC v/!d; s/.*v//' )$
END_VERSIONS$
Every line — including the END_VERSIONS terminator — is indented with 4 spaces. The <<- heredoc operator strips leading tabs only, not spaces. So the terminator stays END_VERSIONS, never matches the bare END_VERSIONS delimiter, the heredoc swallows it (and everything after), and versions.yml is malformed. grep -P '\t' over the whole .command.sh: zero tabs.
The nf-core module is fine — it ships the same <<-END_VERSIONS with space indentation, and it works on every other executor. The difference: Nextflow normally writes the script flush-left in .command.sh (common leading whitespace stripped), so the space-indented terminator ends up at column 0 and matches. nf-spawn preserves the source indentation when it embeds task.script into its cat > .command.sh <<'NF_SPAWN_TASK_EOF' staging heredoc, so the terminator is no longer at column 0 → <<- can't strip spaces → broken.
Suggested fix
Write the task script into .command.sh the way Nextflow does — flush-left (strip the common leading indentation from task.script before embedding), or otherwise ensure heredoc terminators land where <<- expects. Any module that emits versions.yml via <<-END_VERSIONS (i.e. essentially all nf-core modules) hits this. A .stripIndent()-equivalent on the script before the cat > .command.sh heredoc should do it.
Evidence / env
nf-spawn 0.2.11, Nextflow 26.04.x, AL2023 arm64, taxprofiler 2.0.0 FASTQC. Malformed versions.yml and the indented .command.sh both pulled from the S3 work dir (classify/a9/0943.../). Observed 2026-06-13.
This is the last thing between the taxprofiler demo and a clean end-to-end run — one sample already completed through to the final report once it got past staging; this heredoc/indent issue is what stops the rest.
Activity
fix: write .command.sh flush-left so `<<-` heredocs match (#43) (#44)
scttfrdmn commentedon Jun 13, 2026
Fixed and released in v0.2.12 (#44) — ZIP is live: https://github.com/spore-host/nf-spawn/releases/tag/v0.2.12
Your diagnosis was exactly right — we were preserving the source indentation when embedding
task.script, so the space-indented<<-END_VERSIONSterminator never landed at column 0 and<<-(tabs-only) couldn't strip it.New
dedentTaskScript()strips the longest common leading-whitespace prefix shared by all non-blank lines before embedding (blank lines ignored, relative indentation inside the script preserved) — i.e. flush-left, the way Nextflow writes.command.shitself. SoEND_VERSIONSnow sits at column 0 and the heredoc closes correctly.38 tests, 0 failures — including an end-to-end assertion that
buildStagingScriptemits the terminator flush-left (\nEND_VERSIONS\nNF_SPAWN_TASK_EOF, noEND_VERSIONS).Bump
TARGET_NF_SPAWN_VERSIONto0.2.12. With staging (#41), perms (#39), and now the heredoc/indent fix all in, the taxprofiler demo should run clean end-to-end across all three samples. Fingers crossed this is the last one between you and the final report.