# Kraken2 error: AttributeError: dict object has no attribute 'type'

**URL:** https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883
**Category:** Technical Support
**Tags:** taxonomy, kraken
**Created:** [July 19, 2024, 5:37pm UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883 "2024-07-19T17:37:45Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Joel\_Daniel\_Tigrero](https://forum.qiime2.org/user_avatar/forum.qiime2.org/joel_daniel_tigrero/32/18901_2.png) [@Joel\_Daniel\_Tigrero](https://forum.qiime2.org/u/Joel_Daniel_Tigrero)
#### Post date: [July 19, 2024, 5:37pm UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883/1 "2024-07-19T17:37:45Z")

</div>

Hello Qiime2 community

I am working on a virtual machine with Rocky Linux. I have downloaded and uploaded the kraken2 pfp database successfully to Qiime, however when i tried to classify my sequences an _AttributeError: 'dict' object has no attribute 'type'_ appeared.  
Here is an outlook of the code that showed the aforementioned error

qiime moshpit classify-kraken2 --i-seqs /root/qiime2/SUELO\_HOUSE/reads --i-kraken2-db /root/qiime2/moshpit\_tutorial/cache/kraken2 --p-threads 100 --p-confidence 0.6 --p-minimum-base-quality 20 --o-hits /root/qiime2/moshpit\_tutorial/cache/kraken\_db\_hits --o-reports /root/qiime2/moshpit\_tutorial/cache/kraken\_db\_hits/kraken\_db\_reports --p-report-minimizer-data --use-cache /root/qiime2/moshpit\_tutorial/cache --verbose --p-memory-mapping False

It took some 30 min or so, for the following message (screenshot enclosed) and the _AttributeError: 'dict' object has no attribute 'type'_ to appear; after executing the above mentioned code.

 ![Screenshot from 2024-07-19 09-48-03](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/f/f/ff926a8acff83087fe0aee00e9329fe801346ae1.png)

Can you shed some light on this? How can we solve the error?

Best

Joel T

---

<div class="post-metadata">

### Author: ![Oddant1](https://forum.qiime2.org/user_avatar/forum.qiime2.org/oddant1/32/17130_2.png) [@Oddant1](https://forum.qiime2.org/u/Oddant1)
#### Post date: [July 25, 2024, 3:06pm UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883/7 "2024-07-25T15:06:11Z")

</div>

Hello @Joel_Daniel_Tigrero apologies for the delayed response, it isn't entirely clear what the issue is, but I have a hunch. You have set `--use-cache /root/qiime2/moshpit_tutorial/cache` but when you attempt to access your inputs from the cache and store your outputs to the cache, you are not using the correct syntax.

Did you create a cache at `/root/qiime2/moshpit_tutorial/cache` using the command `qiime tools cache-create`?

---

<div class="post-metadata">

### Author: ![Joel\_Daniel\_Tigrero](https://forum.qiime2.org/user_avatar/forum.qiime2.org/joel_daniel_tigrero/32/18901_2.png) [@Joel\_Daniel\_Tigrero](https://forum.qiime2.org/u/Joel_Daniel_Tigrero)
#### Post date: [July 25, 2024, 8:17pm UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883/8 "2024-07-25T20:17:47Z")

</div>

> [@Joel\_Daniel\_Tigrero](#):
>
> -use-cache /root/qiime2/moshpit\_tutorial/cache

Thank you Oddant1. Could you please indicate where do I have to check for a syntax error? I checked the structure of my cache folder and I have all the necessary files for the Kraken2 analysis. I also tried to create the cache folder with the `qiime tools cache-create` command you mentioned and also resulted in the Attribute error: dict object has no attribute ´type´.

Do you have any further thoughts about this issue?

Best

Joel T

---

<div class="post-metadata">

### Author: ![jphagen](https://forum.qiime2.org/user_avatar/forum.qiime2.org/jphagen/32/17133_2.png) [@jphagen](https://forum.qiime2.org/u/jphagen)
#### Post date: [July 25, 2024, 9:05pm UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883/9 "2024-07-25T21:05:57Z")

</div>



---

<div class="post-metadata">

### Author: ![Oddant1](https://forum.qiime2.org/user_avatar/forum.qiime2.org/oddant1/32/17130_2.png) [@Oddant1](https://forum.qiime2.org/u/Oddant1)
#### Post date: [July 25, 2024, 9:39pm UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883/10 "2024-07-25T21:39:36Z")

</div>

I'm not sure how or why `qiime tools cache-create` would produce that error. That is pretty strange.

Can you try removing the `--use-cache` argument entirely and rerunning your command? If the command still fails please post the output here. Additionally, if the command fails can you run `ls -al /root/qiime2/moshpit_tutorial/cache` and post the result of that here?

---

<div class="post-metadata">

### Author: ![Oddant1](https://forum.qiime2.org/user_avatar/forum.qiime2.org/oddant1/32/17130_2.png) [@Oddant1](https://forum.qiime2.org/u/Oddant1)
#### Post date: [July 25, 2024, 9:39pm UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883/11 "2024-07-25T21:39:42Z")

</div>



---

<div class="post-metadata">

### Author: ![Joel\_Daniel\_Tigrero](https://forum.qiime2.org/user_avatar/forum.qiime2.org/joel_daniel_tigrero/32/18901_2.png) [@Joel\_Daniel\_Tigrero](https://forum.qiime2.org/u/Joel_Daniel_Tigrero)
#### Post date: [July 28, 2024, 9:07pm UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883/12 "2024-07-28T21:07:29Z")

</div>

Thanks for the advice Oddant1

I removed the use cache argument entirely and reran the command however the Attribute error still appeared.

 ![Screenshot from 2024-07-28 15-59-38](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/9/4/94c338a494eed56c68d2d14fc9329a72e9f69e9a.png)

I also ran `ls -al /root/qiime2/moshpit_tutorial/cache` and it produced the following output

 ![Screenshot from 2024-07-28 16-02-45](https://forum-qiime2-org.s3.dualstack.us-west-2.amazonaws.com/original/3X/4/a/4ab6c41bba8b13fa4e3846a2ef25cd927c29722e.png)

Best

Joel T.

---

<div class="post-metadata">

### Author: ![lizgehret](https://forum.qiime2.org/user_avatar/forum.qiime2.org/lizgehret/32/17128_2.png) [@lizgehret](https://forum.qiime2.org/u/lizgehret)
#### Post date: [July 29, 2024, 6:35pm UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883/13 "2024-07-29T18:35:24Z")

</div>



---

<div class="post-metadata">

### Author: ![Oddant1](https://forum.qiime2.org/user_avatar/forum.qiime2.org/oddant1/32/17130_2.png) [@Oddant1](https://forum.qiime2.org/u/Oddant1)
#### Post date: [July 29, 2024, 10:22pm UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883/14 "2024-07-29T22:22:34Z")

</div>

Very strange. I will look into how this error is coming about, but there are a few things wrong here.

1. You appear to be passing directories into `--i-seqs` and `--i-kraken2-db` when these should be receiving individual artifacts. I BELIEVE this is the root source of this error, but I'm not sure how this specific error came from you doing this. We definitely need to make a more useful error message for this if I am correct.
2. Your `/root/qiime2/moshpit_tutorial/cache` directory appears to contain the necessary pieces to be a cache, but it also contains `bracken`, `kraken2`, `kraken_db_hits`, and `kraken_db_reports` which shouldn't be there. They look like they're meant to be cache entries, but cache entries should be in the form of data referenced by keys not additional folders in the cache. Did you intend to make this directory a QIIME 2 cache?

---

<div class="post-metadata">

### Author: ![Oddant1](https://forum.qiime2.org/user_avatar/forum.qiime2.org/oddant1/32/17130_2.png) [@Oddant1](https://forum.qiime2.org/u/Oddant1)
#### Post date: [July 29, 2024, 10:22pm UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883/15 "2024-07-29T22:22:38Z")

</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: [August 30, 2024, 4:23am UTC](https://forum.qiime2.org/t/kraken2-error-attributeerror-dict-object-has-no-attribute-type/30883/16 "2024-08-30T04:23:11Z")

</div>

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