Could not parse the header line

Error using samtools mpileup

samtools mpileup SAMPLE_sorted.bam

"Could not parse the header line:... "


The problem can be due to a comma in the gene/contig ID


Samtools mpileup is adding information to the original contig ID separated by comma.


and gets confused if the gene ID already includes a comma: 1005929-1007642,1007542-1008571


Remove all comma from your gene or contig ID names before running samtools.