# Error prevents app\_metadata update in Rule

**URL:** <https://community.auth0.com/t/error-prevents-app-metadata-update-in-rule/14275>\
**Category:** Get Help\
**Created:** [August 13, 2018, 8:50pm UTC](https://community.auth0.com/t/error-prevents-app-metadata-update-in-rule/14275 "2018-08-13T20:50:21Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![croptixsolutions](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/croptixsolutions/32/10446_2.png) [@croptixsolutions](https://community.auth0.com/u/croptixsolutions)\
**Post date:** [August 13, 2018, 8:50pm UTC](https://community.auth0.com/t/error-prevents-app-metadata-update-in-rule/14275/1 "2018-08-13T20:50:21Z")

</div>

I am unable to add app\_metadata to a user using a Rule. I attempted to use the boilerplate code I found here in the docs:

> **[Manage Metadata with Rules - Auth0 Docs](https://auth0.com/docs/manage-users/user-accounts/metadata/manage-metadata-rules)**
>
> Learn how to manage with app metadata, user metadata, and client metadata using Rules.

```
function (user, context, callback) {
  user.app_metadata = user.app_metadata || {};
  // update the app_metadata that will be part of the response
  user.app_metadata.test = "test!";

  // persist the app_metadata update
  auth0.users.updateAppMetadata(user.user_id, user.app_metadata)
    .then(function(){
      callback(null, user, context);
    })
    .catch(function(err){
      callback(err);
    });
}

```

I receive the following error:

```
ERROR: The user does not exist.

```

What am I doing wrong here?

---

<div class="post-metadata">

**Author:** ![croptixsolutions](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/croptixsolutions/32/10446_2.png) [@croptixsolutions](https://community.auth0.com/u/croptixsolutions)\
**Post date:** [August 15, 2018, 3:04pm UTC](https://community.auth0.com/t/error-prevents-app-metadata-update-in-rule/14275/2 "2018-08-15T15:04:50Z")

</div>

Update: This only seems to be an error when testing the rule. The rule does seem to work correctly when users authenticate.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [July 26, 2019, 9:12am UTC](https://community.auth0.com/t/error-prevents-app-metadata-update-in-rule/14275/3 "2019-07-26T09:12:41Z")

</div>

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