# Error - invalid start byte - Metaphlan3

**URL:** <https://forum.biobakery.org/t/error-invalid-start-byte-metaphlan3/1546>\
**Category:** MetaPhlAn\
**Created:** [January 15, 2021, 9:53pm UTC](https://forum.biobakery.org/t/error-invalid-start-byte-metaphlan3/1546 "2021-01-15T21:53:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Scot\_Zens](https://avatars.discourse-cdn.com/v4/letter/s/b4bc9f/32.png) [@Scot\_Zens](https://forum.biobakery.org/u/Scot_Zens)\
**Post date:** [January 15, 2021, 9:53pm UTC](https://forum.biobakery.org/t/error-invalid-start-byte-metaphlan3/1546/1 "2021-01-15T21:53:51Z")

</div>

Hello,  
We have been processing through the steps in metaphlan 3 and most of our samples produce results that we understand. But sometimes we get an error stream (in bowtie) that looks like this (see below). It ends in the traceback with an invalid start byte error. There wasn’t a corresponding error encountered when we ran through the kneaddata steps. And a visual inspection of the kneaddata files doesn’t raise any red flags.

1. is this at all familiar?
2. what do we need to do to avoid this error in our processing of metaphlan 3?

Thanks so much  
Scot Zens  
— start of Error message -----------------------------------------------------------------  
Use of uninitialized value $bt2\_args[2] in join or string at /HOME/miniconda3/bin/bowtie2 line 423.  
Use of uninitialized value bt2\_args[3] in join or string at /HOME/miniconda3/bin/bowtie2 line 423. Use of uninitialized value _[2] in string eq at /HOME/miniconda3/bin/bowtie2 line 360.  
Use of uninitialized value $_[3] in string eq at /HOME/miniconda3/bin/bowtie2 line 360.  
Use of uninitialized value in exists at /HOME/miniconda3/bin/bowtie2 line 81.  
Use of uninitialized value in exists at /HOME/miniconda3/bin/bowtie2 line 81.  
Use of uninitialized value $bt2\_args[2] in join or string at /HOME/miniconda3/bin/bowtie2 line 459.  
Use of uninitialized value $bt2\_args[3] in join or string at /HOME/miniconda3/bin/bowtie2 line 459.  
Traceback (most recent call last):  
File “/HOME/miniconda3/bin/read\_fastx.py”, line 10, in   
sys.exit(main())  
File “/HOME/miniconda3/lib/python3.8/site-packages/metaphlan/utils/read\_fastx.py”, line 155, in main  
nreads += read\_and\_write\_raw(f, opened=False, min\_len=min\_len)  
File “/HOME/miniconda3/lib/python3.8/site-packages/metaphlan/utils/read\_fastx.py”, line 119, in read\_and\_write\_raw  
nreads = read\_and\_write\_raw\_int(inf, min\_len=min\_len)  
File “/HOME/miniconda3/lib/python3.8/site-packages/metaphlan/utils/read\_fastx.py”, line 64, in read\_and\_write\_raw\_int  
l = fd.readline()  
File “/HOME/miniconda3/lib/python3.8/codecs.py”, line 322, in decode  
(result, consumed) = self.\_buffer\_decode(data, self.errors, final)  
UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0x8b in position 1: invalid start byte  
— end of Error message -----------------------------------------------------------------

---

<div class="post-metadata">

**Author:** ![fbeghini](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/fbeghini/32/81_2.png) [@fbeghini](https://forum.biobakery.org/u/fbeghini)\
**Post date:** [January 19, 2021, 11:00am UTC](https://forum.biobakery.org/t/error-invalid-start-byte-metaphlan3/1546/2 "2021-01-19T11:00:35Z")

</div>

About the “Use of uninitialized value” warnings, see [[Warnings] MetaPhlAn version 3.0 · Issue #101 · biobakery/MetaPhlAn (github.com)](https://github.com/biobakery/MetaPhlAn/issues/101#issuecomment-646657221), it does not affect the analysis.

For the UnicodeDecodeError, can you paste here the command line you used?

---

<div class="post-metadata">

**Author:** ![TKsh6](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/tksh6/32/1991_2.png) [@TKsh6](https://forum.biobakery.org/u/TKsh6)\
**Post date:** [February 23, 2023, 1:10pm UTC](https://forum.biobakery.org/t/error-invalid-start-byte-metaphlan3/1546/3 "2023-02-23T13:10:45Z")

</div>

I also had this problem.I was trying to run the command  
`metaphlan ${readall} --bowtie2out ${bowres} --nproc 5 --input_type fastq -o ${res} --bowtie2db /beegfs/home/syl/database_db/metaphlan_database`  
but it throws the following output:

```auto
Traceback (most recent call last):
  File "/beegfs/home/syl/anaconda3/envs/kofamscan/bin/read_fastx.py", line 8, in <module>
    sys.exit(main())
  File "/beegfs/home/syl/anaconda3/envs/kofamscan/lib/python3.7/site-packages/metaphlan/utils/read_fastx.py", line 168, in main
    f_nreads, f_avg_read_length = read_and_write_raw(f, opened=False, min_len=min_len, prefix_id=prefix_id)
  File "/beegfs/home/syl/anaconda3/envs/kofamscan/lib/python3.7/site-packages/metaphlan/utils/read_fastx.py", line 130, in read_and_write_raw
    nreads, avg_read_length = read_and_write_raw_int(inf, min_len=min_len, prefix_id=prefix_id)
  File "/beegfs/home/syl/anaconda3/envs/kofamscan/lib/python3.7/site-packages/metaphlan/utils/read_fastx.py", line 70, in read_and_write_raw_int
    l = fd.readline()
  File "/beegfs/home/syl/anaconda3/envs/kofamscan/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte

```

Can you help me with this problem?. Because I don’t know if it’s problem of instalation or the server from which the data is beeing requested.

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![Day](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/day/32/2352_2.png) [@Day](https://forum.biobakery.org/u/Day)\
**Post date:** [August 15, 2023, 7:51am UTC](https://forum.biobakery.org/t/error-invalid-start-byte-metaphlan3/1546/4 "2023-08-15T07:51:13Z")

</div>

same issue but with different command  
`$ sample2markers.py -i bam.bz2 -o ../strainphlan/ -d ../mpa/`

I got an error message with the following

````auto
Tue Aug 15 13:14:06 2023: Start samples to markers execution
Tue Aug 15 13:14:06 2023: Creating temporary directory...
Tue Aug 15 13:14:06 2023: Done.
Tue Aug 15 13:14:06 2023: Filtering SAM files...
Tue Aug 15 13:14:06 2023: [Error] Parallel execution fails: 'utf-8' codec can't decode byte 0x8b in position 1: invalid start byte
Tue Aug 15 13:14:06 2023: Stop StrainPhlAn execution.```
````

---

<div class="post-metadata">

**Author:** ![aitor.blancomiguez](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.biobakery.org/aitor.blancomiguez/32/86_2.png) [@aitor.blancomiguez](https://forum.biobakery.org/u/aitor.blancomiguez)\
**Post date:** [September 1, 2023, 12:15pm UTC](https://forum.biobakery.org/t/error-invalid-start-byte-metaphlan3/1546/5 "2023-09-01T12:15:11Z")

</div>

Hi @Day  
It seems an error with the input format, is it in compressed BAM or SAM format? If the input is a bam file it **cannot** be compressed and you must specify the parameter `--input_format bam` . If it is in sam format but **NOT** compressed, it should be `--input_format sam`.
