# UnicodeDecodeError: ‘ascii’ codec can’t decode byte 0x8b in position 513

**URL:** https://forum.qiime2.org/t/unicodedecodeerror-ascii-codec-can-t-decode-byte-0x8b-in-position-513/5712
**Category:** User Support
**Created:** [August 22, 2018, 7:26am UTC](https://forum.qiime2.org/t/unicodedecodeerror-ascii-codec-can-t-decode-byte-0x8b-in-position-513/5712 "2018-08-22T07:26:35Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![ariel](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ariel/32/2587_2.png) [@ariel](https://forum.qiime2.org/u/ariel)
#### Post date: [August 22, 2018, 7:26am UTC](https://forum.qiime2.org/t/unicodedecodeerror-ascii-codec-can-t-decode-byte-0x8b-in-position-513/5712/1 "2018-08-22T07:26:35Z")

</div>

**Hi 🙂 so excitingly, my manifest file now works, however I'm getting this error upon import:**

qiime tools import --type 'SampleData[PairedEndSequencesWithQuality]' --input-path manifest.txt --output-path ../paired-end-demux.qza --source-format PairedEndFastqManifestPhred33  
Traceback (most recent call last):  
File "/home/abganz/.conda/envs/qiime2/lib/python3.5/site-packages/q2cli/tools.py", line 116, in import\_data  
view\_type=source\_format)  
File "/home/abganz/.conda/envs/qiime2/lib/python3.5/site-packages/qiime2/sdk/result.py", line 219, in import\_data  
return cls._from\_view(type_, view, view\_type, provenance\_capture)  
File "/home/abganz/.conda/envs/qiime2/lib/python3.5/site-packages/qiime2/sdk/result.py", line 244, in \_from\_view  
result = transformation(view)  
File "/home/abganz/.conda/envs/qiime2/lib/python3.5/site-packages/qiime2/core/transform.py", line 73, in transformation  
other.validate(new\_view)  
File "/home/abganz/.conda/envs/qiime2/lib/python3.5/site-packages/qiime2/core/transform.py", line 143, in validate  
view.validate('min')  
File "/home/abganz/.conda/envs/qiime2/lib/python3.5/site-packages/qiime2/plugin/model/directory\_format.py", line 171, in validate  
getattr(self, field).\_validate\_members(collected\_paths, level)  
File "/home/abganz/.conda/envs/qiime2/lib/python3.5/site-packages/qiime2/plugin/model/directory\_format.py", line 101, in \_validate\_members  
self.format(path, mode='r').validate(level)  
File "/home/abganz/.conda/envs/qiime2/lib/python3.5/site-packages/qiime2/plugin/model/file\_format.py", line 24, in validate  
self._validate_(level)  
File "/home/abganz/.conda/envs/qiime2/lib/python3.5/site-packages/q2\_types/per\_sample\_sequences/\_format.py", line 159, in _validate_  
self.\_check\_n\_records(record\_count\_map[level])  
File "/home/abganz/.conda/envs/qiime2/lib/python3.5/site-packages/q2\_types/per\_sample\_sequences/\_format.py", line 119, in _check\_n\_records  
for i, record in file_:  
File "/home/abganz/.conda/envs/qiime2/lib/python3.5/encodings/ascii.py", line 26, in decode  
return codecs.ascii\_decode(input, self.errors)[0]  
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8b in position 513: ordinal not in range(128)

An unexpected error has occurred:

'ascii' codec can't decode byte 0x8b in position 513: ordinal not in range(128)

See above for debug info.

**after reading some other help topics, I tried this:**  
**echo $LC\_ALL**  
en\_US.utf8  
**echo $LANG**

**export LANG=en\_US.utf8**

and got the same error.

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [August 22, 2018, 2:23pm UTC](https://forum.qiime2.org/t/unicodedecodeerror-ascii-codec-can-t-decode-byte-0x8b-in-position-513/5712/2 "2018-08-22T14:23:05Z")

</div>

> [@Importing paired end reads that have been both paired and demultiplexed](https://forum.qiime2.org/t/importing-paired-end-reads-that-have-been-both-paired-and-demultiplexed/5256/15):
>
> ‘ascii’ codec can’t decode byte 0x8b in position 513: ordinal not in range(128)

Sounds like your raw data might be corrupted — check out [this thread](https://forum.qiime2.org/t/unicodedecodeerror-utf-8-codec-cant-decode-byte-0x8b-in-position-1-invalid-start-byte/3385) and [this post](https://forum.qiime2.org/t/data-importing-error/5603/3) and let us know what you see!

---

<div class="post-metadata">

### Author: ![ariel](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ariel/32/2587_2.png) [@ariel](https://forum.qiime2.org/u/ariel)
#### Post date: [August 22, 2018, 5:01pm UTC](https://forum.qiime2.org/t/unicodedecodeerror-ascii-codec-can-t-decode-byte-0x8b-in-position-513/5712/3 "2018-08-22T17:01:58Z")

</div>

Hi Nicholas,

Thank you so much. I'm trying to simultaneously work on re downloading the files.

The results from what I got when trying what was in the thread are above. I found that LANG was empty so tried **export LANG=en\_US.utf8** , and then tried importing again and got the same error.

Here is what I from the second link's suggestions :

**$ file H\_R1\_001.fastq.gz**

H\_R1\_001.fastq.gz: gzip compressed data, max speed

**$ gunzip H\_R1\_001.fastq.gz**

**$ file H\_R1\_001.fastq**

H\_R1\_001.fastq: ASCII text, with very long lines

notably these are thousands of files downloaded from a couple different sources so it's possible that only some of them have a problem.

---

<div class="post-metadata">

### Author: ![Nicholas\_Bokulich](https://forum.qiime2.org/user_avatar/forum.qiime2.org/nicholas_bokulich/32/19937_2.png) [@Nicholas\_Bokulich](https://forum.qiime2.org/u/Nicholas_Bokulich)
#### Post date: [August 22, 2018, 5:22pm UTC](https://forum.qiime2.org/t/unicodedecodeerror-ascii-codec-can-t-decode-byte-0x8b-in-position-513/5712/4 "2018-08-22T17:22:25Z")

</div>



---

<div class="post-metadata">

### Author: ![ariel](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ariel/32/2587_2.png) [@ariel](https://forum.qiime2.org/u/ariel)
#### Post date: [August 22, 2018, 11:37pm UTC](https://forum.qiime2.org/t/unicodedecodeerror-ascii-codec-can-t-decode-byte-0x8b-in-position-513/5712/5 "2018-08-22T23:37:52Z")

</div>

@Nicholas_Bokulich As an update, I went and re-downloaded the files and sorted out ones that might be problematic, and was extremely thorough (the amazing person that maintains the Stanford cluster I'm using helped me to do the best job possible)...and I still get the same error.

This time when I ran

**echo $LC\_ALL**

**echo $LANG**  
en\_US.UTF-8

LC\_ALL was empty, so I set it using: export LC\_ALL=en\_US.utf8 and then tried again and I still got the same error.

Do you have any suggestions?

Update 2--  
for f in untarred/\*.gz; do grep $'x8b' $f; done  
several matched, so I'm going to take them out and try again.

Update 3--  
got the same error again. I'm going to search again for the bad character in the unzipped files and will update you.

---

<div class="post-metadata">

### Author: ![ariel](https://forum.qiime2.org/user_avatar/forum.qiime2.org/ariel/32/2587_2.png) [@ariel](https://forum.qiime2.org/u/ariel)
#### Post date: [August 23, 2018, 7:22am UTC](https://forum.qiime2.org/t/unicodedecodeerror-ascii-codec-can-t-decode-byte-0x8b-in-position-513/5712/6 "2018-08-23T07:22:09Z")

</div>

It worked!

What worked was searching all the untarred, unzipped files for the character and also doing file on each file to find additional problems

In case this helps someone later, I did that like this:  
for f in folder-with-files/\*;  
do file $f;  
done

Thank you so so much for your help

---

<div class="post-metadata">

### Author: ![thermokarst](https://forum.qiime2.org/letter_avatar_proxy/v4/letter/t/8e7dd6/32.png) [@thermokarst](https://forum.qiime2.org/u/thermokarst)
#### Post date: [August 23, 2018, 2:32pm UTC](https://forum.qiime2.org/t/unicodedecodeerror-ascii-codec-can-t-decode-byte-0x8b-in-position-513/5712/7 "2018-08-23T14:32:25Z")

</div>



---

<div class="post-metadata">

### Author: ![system](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/2/1/21af5fe23cb6f4579467c66a9ed94e55274ca7bd.svg) [@system](https://forum.qiime2.org/u/system)
#### Post date: [September 23, 2018, 8:32pm UTC](https://forum.qiime2.org/t/unicodedecodeerror-ascii-codec-can-t-decode-byte-0x8b-in-position-513/5712/8 "2018-09-23T20:32:28Z")

</div>

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
