# Python agent raise ValueError

**URL:** <https://discuss.elastic.co/t/python-agent-raise-valueerror/233263>\
**Category:** APM\
**Tags:** python\
**Created:** [May 19, 2020, 7:53am UTC](https://discuss.elastic.co/t/python-agent-raise-valueerror/233263 "2020-05-19T07:53:48Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![leslie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leslie/32/77605_2.png) [@leslie](https://discuss.elastic.co/u/leslie)\
**Post date:** [May 19, 2020, 7:53am UTC](https://discuss.elastic.co/t/python-agent-raise-valueerror/233263/1 "2020-05-19T07:53:48Z")

</div>

Hi all,

After my django application intergrating with elastic-apm, I received some errors of apm agent. I can see them in sentry and kibana( `/app/apm#/services/<my service>/errors` ).

The error is:

```auto
ValueError: too many values to unpack(expected 2)

```

It do not happen each time of calling my application api, I have not catched the rule yet.

**Kibana version** : 7.6.1

**Elasticsearch version** : 7.6.1

**APM Server version** : 7.6.1

**APM Agent language and version** : python3 + django + elastic-apm 5.6.0

here is the error happening I find on apm board, it seems frames object has too many attributes.  
 ![图片](https://us1.discourse-cdn.com/elastic/original/3X/2/b/2bfdbb88d26a5b04bf778dede0868651ffbe0549.png)

 ![图片](https://us1.discourse-cdn.com/elastic/original/3X/c/0/c0302ba71ba06f65eda1b97db4f2013b39672ab7.png)

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [May 20, 2020, 2:43pm UTC](https://discuss.elastic.co/t/python-agent-raise-valueerror/233263/2 "2020-05-20T14:43:52Z")

</div>

Hello @leslie!

I'm at a bit of a loss as to how you could be seeing this error. I've followed every code path that generates `frames`, and as far as I can tell it should always be a list of `(frame, line_number)` tuples. Somehow you're seeing a list of dictionaries, and I honestly have no idea how that could happen.

Could you give us more details on your app, how you installed the `elastic-apm` library, etc? I'm trying to figure out what's different about your deployment that I'm missing.

---

<div class="post-metadata">

**Author:** ![leslie](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leslie/32/77605_2.png) [@leslie](https://discuss.elastic.co/u/leslie)\
**Post date:** [May 27, 2020, 3:06am UTC](https://discuss.elastic.co/t/python-agent-raise-valueerror/233263/4 "2020-05-27T03:06:16Z")

</div>

hi @basepi ，

thanks for your reply.

These day we thought it may be caused by too many requests . our application has about 10,000 requests per minute, and load balanced on 4 servers. APM agent is triggered on one of the servers only. So I depressed the weight of the server, but the error keeps appearing on not regular rule:

- most of the requests do not trigger the error
- it seems nothing about which url is called  
 ![图片](https://us1.discourse-cdn.com/elastic/original/3X/c/1/c18f4a6691fbdfbf33edab8e147639f5ac0e2365.png)

the apm server is installed by cmd `yum localinstall apm-server-7.6.1-x86_64.rpm`, and has 2 servers load balanced.

the apm agent is installed by cmd `pip install elastic-apm==5.6.0`, and the django setting looks as

```auto
if os.environ.get('APM_SERVICE_NAME'):

    INSTALLED_APPS += (
        'elasticapm.contrib.django',
    )

    ELASTIC_APM = {
      'SERVICE_NAME': os.environ.get('APM_SERVICE_NAME'),
      'SECRET_TOKEN': '',
      'SERVER_URL': 'http://devops-apm. ******.com',
      'DEBUG': True,
    }

    MIDDLEWARE += [
      'elasticapm.contrib.django.middleware.TracingMiddleware',
    ]

```

---

<div class="post-metadata">

**Author:** ![basepi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/basepi/32/53056_2.png) [@basepi](https://discuss.elastic.co/u/basepi)\
**Post date:** [May 27, 2020, 5:23pm UTC](https://discuss.elastic.co/t/python-agent-raise-valueerror/233263/5 "2020-05-27T17:23:53Z")

</div>

You're not doing anything out of the ordinary from what I can see. I opened a PR to suppress these errors for now: [https://github.com/elastic/apm-agent-python/pull/837](https://github.com/elastic/apm-agent-python/pull/837)

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 17, 2020, 1:24pm UTC](https://discuss.elastic.co/t/python-agent-raise-valueerror/233263/6 "2020-06-17T13:24:04Z")

</div>

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