fix strobealign log error#302
Merged
Merged
Conversation
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
Fix a panic in complete_processes that hides the real mapping error when a mapper's captured stderr log can't be decoded as UTF-8, and add regression tests.
Background
A downstream project (binchicken) hit CoverM failures when mapping with strobealign 0.17.0 against .fastq.gz reads on certain filesystems/sandboxes. Two related failures were reported:
thread 'main' (10381) panicked at src/bam_generator.rs:266:37:
Failed to read log file for STROBEALIGN
note: run with
RUST_BACKTRACE=1environment variable to display a backtrace[2026-07-10T01:11:32Z ERROR coverm::bam_generator] The STDERR for the STROBEALIGN part was: This is strobealign 0.17.0
strobealign: mmap failed to open file: /tmp/tmpxu7laryn/test/coassemble/qc/SRR8334323_1.fastq.gz: Invalid argument
[2026-07-10T01:11:32Z ERROR coverm::bam_generator] Cannot continue since mapping failed.
The second log shows the actual underlying cause (strobealign itself fails to mmap the input FASTQ, an upstream/environment issue — --mapper minimap2-sr works around it). The first log is a separate, genuine CoverM bug: complete_processes read the captured mapper stderr with read_to_string, which errors out on non-UTF-8 bytes (e.g. progress/control characters some mappers write to stderr). That error was turned into a panic via unwrap_or_else(|_| panic!(...)), which crashes CoverM outright and destroys the real error message before the user ever sees it — as happened in the first log above.
Changes
Scope / non-goals
This does not fix strobealign's mmap failure itself — that lives in the external strobealign binary (or the filesystem it's running on) and is outside CoverM's control. This PR only ensures CoverM surfaces the real error instead of panicking and hiding it.
Test plan