# Errors and Troubleshooting

## General Errors

Here is the list of common errors that you may receive while using any of our API services:

### `400: Bad Request`

```javascript
{
    "code":"general.badRequest","message":"Invalid date: GrpcDate(2020,3,128)"
}
```

This failed response appears when error codes are found in the endpoint query. The possible error codes that may appear are:&#x20;

| Error Code                                    | Description                                                                                 | Troubleshooting                                                                           |
| --------------------------------------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
| <p></p><p><code>general.badRequest</code></p> | This error code appears when there is invalid data format found in the request.             | Check your request headers and parameters to fix the data formatting issue.               |
| <p></p><p><code>general.notFound</code></p>   | This error code appears when an ID of a resource specified in the API request is not found. | <ul><li>Check if the ID is correct.</li><li>Check if the resource still exists.</li></ul> |

### `401: Unauthorized`

```javascript
{
    "code":"auth.tokenNotFound"
}
```

This failed response appears due to API authentication failure. The possible error codes that may appear are:&#x20;

| Error Code                                   | Description                                                               | Troubleshooting                                           |
| -------------------------------------------- | ------------------------------------------------------------------------- | --------------------------------------------------------- |
| <p></p><p><code>auth.tokenExpired</code></p> | This error code appears when the authentication token in use has expired. | <p>This error usually occurs due to one of the following: |

</p><p></p><ul><li>TTL is greater than 24 hours</li><li>Token is not yet valid or already expired</li></ul> |
| <p></p><p><code>auth.tokenRequired</code></p>                                                     | This error code appears when you forget to use an authentication token in your API request.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | Specify the token in the Authorization header, or use it as a query parameter in the request URL.                                                                        |
| <p></p><ul><li><code>auth.tokenNotFound</code> </li><li><code>oauth.unauthorized</code></li></ul> | <p></p><p>The <code>auth.tokenNotFound</code> or <code>oauth.unauthorized</code> error usually occurs due to one of the following reasons:</p><ul><li><p>The token currently in use got deleted when:</p><ul><li>the user logged out.</li><li>the app used the refresh token connected to the access token.</li></ul></li><li><p>All (user, application) pair tokens got deleted when:</p><ul><li>the user somehow unlinked the whisk account from the client app.</li></ul></li><li><p>All user tokens got deleted when:</p><ul><li>the user changed the password.</li><li>the user reset the password.</li><li>the user used the auth code.</li><li>the user deleted the whisk account.</li></ul></li></ul> | Regenerate or request a new token.                                                                                                                                       |

### `403: Bad Request`

```javascript
{
  "code": "authorization.scopeRequired"
}
```

This failed response appears when the request is formed and authenticated correctly, but the API refuses to accept it due to insufficient permission. The possible error codes that may appear are:&#x20;

| Error Code                                             | Description                                                                                                           | Troubleshooting                                                                                                                                    |
| ------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p></p><p><code>authorization.denied</code></p>        | This error code appears when your token has insufficient permission to access a resource.                             | You may be using the wrong or a different token. Try again with a [user access token](https://docs.whisk.com/api-overview/auth/user-access-token). |
| <p></p><p><code>authorization.scopeRequired</code></p> | This error code appears when the authorization token is missing a specific scope that is needed to access a resource. | Regenerate or request a new token with the required scopes.                                                                                        |

### `500: Internal Server Error`

```javascript
This is unexpected response, something is wrong on our side, please contact: help@whisk.com
```

This failed response appears when something is not right on Whisk's end. Please send a message to <help@whisk.com>, and be sure to include both the Request and Response data. We’ll get back to you soon.

## Unique Errors

Here is the list of errors you may only receive while using specific API services:

### `COMMUNITY_ERROR_TOPIC_NOT_FOUND`

| Description                                                                          | API Services                                                                                        | Troubleshooting                                                                                                                                                      |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| This error appears when you try to read a topic's data but the topic can't be found. | <p></p><p><a href="../api/community/get-communities-by-topic">Get communities from a topic.</a></p> | <ul><li>Check if the <code>topic\_id</code> used in the API request is correct.</li><li>Check if the topic still exists on Whisk and has not been deleted.</li></ul> |

### `COMMUNITY_ERROR_NOT_FOUND`

| Description                                                                                  | API Services                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Troubleshooting                                                                                                                                                            |
| -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| This error appears when you try to read a community's data but the community can't be found. | <p></p><ul><li><a href="../api/community/get-a-community">Get details of a specific community.</a></li><li><a href="../api/community/get-recipes-from-a-community">Get a recipes from a community.</a></li><li><a href="../api/community/add-recipes-to-a-community">Add recipes to a community.</a></li><li><a href="../api/community/remove-a-recipe-from-a-community">Remove a recipe from a community.</a></li><li><a href="../../api/community/join-a-community#join-a-community">Join a community.</a></li><li><a href="../../api/community/join-a-community#join-a-community">Leave a community.</a></li></ul> | <p></p><ul><li>Check if the <code>community\_id</code> used in the API request is correct.</li><li>Check if the community still exists on Whisk and has not been</li></ul> |

### `COMMUNITY_ERROR_RECIPE_ALREADY_ADDED`

| Description                                                                         | API Services                                                                                        | Troubleshooting                                                                                                                                                                                                                   |
| ----------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| This error appears when you try to add recipes that already exist in the community. | <p></p><p><a href="../api/community/add-recipes-to-a-community">Add recipes to a community.</a></p> | Search for the recipe inside the community on Whisk as it may already exist there. If you don't find it there, then check if the recipe ID you used in your API request belongs to the recipe you wanted to add to the community. |

### `COMMUNITY_ERROR_ALREADY_COMMUNITY_MEMBER`

| Description                                                                          | API Services                                                                                        | Troubleshooting                                                                                                                                                                                                                 |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| This error appears when you try to join a community but you're already member of it. | <p></p><p><a href="../../api/community/join-a-community#join-a-community">Join a community.</a></p> | Search for the community on Whisk and check if you are already a member there. If it shows you a button join the community, then check the community ID you used in your API request as it may belong to a different community. |

### `COMMUNITY_ERROR_NOT_A_COMMUNITY_MEMBER`

| Description                                                                         | API Services                                                                                         | Troubleshooting                                                                                                                                                                                                                                                  |
| ----------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| This error appears when you try to leave a community but you're not a member of it. | <p></p><p><a href="../../api/community/join-a-community#join-a-community">Leave a community.</a></p> | Search for the community on Whisk and check if it shows you a button join the community as may not have join it. If shows that you're already a member of it then check the community ID you used in your API request as it may belong to a different community. |

### `LIST_ERROR_NOT_FOUND`

| Description                                                                                          | API Services                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Troubleshooting                                                                                                                                                                        |
| ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| This error appears when you try to read a shopping list's data but the shopping list can't be found. | <p></p><ul><li>Get a list of all shopping lists of a user.</li><li><a href="../api/shopping-lists/get-shopping-lists">Get a shopping list.</a></li><li>Move items from one shopping list to another.</li><li><a href="broken-reference">Delete a shopping list.</a></li><li><a href="broken-reference">Edit a shopping list.</a></li><li>Clear items from a shopping list.</li><li><a href="broken-reference">Add items to a shopping list.</a></li><li>Delete an item from a shopping list.</li><li>Update an item in a shopping list.</li></ul> | <p></p><ul><li>Check if the shopping list <code>id</code> used in the API request is correct.</li><li>Check if the community still exists on Whisk and has not been deleted.</li></ul> |

### `LIST_ERROR_RECIPE_UNAVAILABLE`

| Description                                                                                                              | API Services                                                                 | Troubleshooting                                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| This error appears when you try to read a recipe's data to add items to the shopping list but the recipe can't be found. | [Create a shopping list.](https://docs.whisk.com/resources/broken-reference) | <p></p><ul><li>Check if the  <code>recipe\_id</code> used in the API request is correct.</li><li>Check if the recipe still exists on Whisk and has not been deleted.</li></ul> |

### `LIST_ERROR_ITEM_NOT_FOUND`

| Description                                                                                       | API Services                                                                                                                                                   | Troubleshooting                                                                                                                                                                               |
| ------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| This error appears when you try to read an item from a shopping list but the item can't be found. | <p></p><ul><li>Move items from one shopping list to another.</li><li>Delete an item from a shopping list.</li><li>Update an item in a shopping list.</li></ul> | <p></p><p></p><ul><li>Check if the  <code>item\_id</code> used in the API request is correct.</li><li>Check if the item still exists in the shopping list and has not been deleted.</li></ul> |

### `LIST_ERROR_CAN_NOT_DELETE_PRIMARY`

| Description                                                                                                                            | API Services                                                         | Troubleshooting                                                |
| -------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- | -------------------------------------------------------------- |
| This error appears when you try to delete a shopping list but it can't be deleted since you have set it as your primary shopping list. | <p></p><p><a href="broken-reference">Delete a shopping list.</a></p> | Try setting some other shopping list as primary and try again. |

### `MEAL_PLAN_ERROR_INVALID_PERIOD`

| Description                                                                              | API Services                                                                                                                                                                                                                                                                                                                                                          | Troubleshooting                                                                                                                                        |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| This error appears when you try to generate a meal plan for an incorrect period of time. | <p></p><ul><li><a href="../api/meal-plans/generate_mealplan">Generate a meal plan for a specific period.</a></li><li><a href="../api/meal-plans/meal/meal-plan-management">Get meals for a specific period from a meal plan.</a></li><li><a href="../api/meal-plans/meal/delete-meals">Clear meals for a specific duration from a particular meal plan.</a></li></ul> | Check if the `period` attribute used in the request is correctly specified. The correct format can be found in the related endpoint description topic. |

### `MEAL_PLAN_ERROR_NOT_FOUND`

| Description                                                                                  | API Services                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Troubleshooting                                                                                                                                                                      |
| -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| This error appears when you try to read a meal plan's data but the meal plan can't be found. | <p></p><ul><li><a href="../api/meal-plans/generate_mealplan">Generate a meal plan for a specific period.</a></li><li><a href="../api/meal-plans/meal/delete-meals">Clear meals for a specific duration from a particular meal plan.</a></li><li><a href="../api/meal-plans/meal/update-meal">Add a meal to a meal plan.</a></li><li><a href="../api/meal-plans/meal/delete-meals">Remove a meal from a meal plan.</a></li><li>Update a meal in a meal plan.</li><li><a href="../api/meal-plans/get-meal-plan-settings/update-meal-plan-settings">Update meal plan settings.</a></li><li><a href="../api/meal-plans/meal/meal-plan-management">Get meals for a specific period from a meal plan.</a></li><li><a href="../api/meal-plans/get-meal-plan-settings/get-meal-plan-settings">Get meal plan settings.</a></li></ul> | <p></p><ul><li>Check if the <code>meal\_plan\_id</code> used in the API request is correct.</li><li>Check if the meal plan still exists on Whisk and has not been deleted.</li></ul> |

### `MEAL_PLAN_ERROR_SLOT_NOT_FREE`

| Description                                                                                                                        | API Services                                                                                                                               | Troubleshooting                                                                                 |
| ---------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------- |
| This error appears when you try to add or update a meal in a meal plan but the requested slot is already occupied by another meal. | <p></p><ul><li><a href="../api/meal-plans/meal/update-meal">Add a meal to a meal plan.</a></li><li>Update a meal in a meal plan.</li></ul> | <ul><li>Check if the requested slot is correct.</li><li>Clear the slot and try again.</li></ul> |

### `MEAL_PLAN_ERROR_DAY_LIMIT_EXCEEDED`

| Description                                                              | API Services                                                                                                                                                                | Troubleshooting                                                                                       |
| ------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| This error appears when you exceed the number of meals allowed in a day. | <p></p><ul><li><a href="../api/meal-plans/meal/update-meal">Add a meal to a meal plan.</a></li><li>Update a meal in a meal plan.</li><li>Modify a batch of meals.</li></ul> | Check if you already have 7 meals, which is the maximum number of meals you can have set for the day. |

### `MEAL_PLAN_ERROR_MEAL_NOT_FOUND`

| Description                                                                                        | API Services                                                                                                                                                                      | Troubleshooting                                                                                                                                                                   |
| -------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| This error appears when you try to read or edit a meal in a meal plan but the meal can't be found. | <p></p><ul><li>Update a meal in a meal plan.</li><li><a href="../api/meal-plans/meal/delete-meals">Remove a meal from a meal plan.</a></li><li>Modify a batch of meals.</li></ul> | <p></p><ul><li>Check if the <code>meal\_id</code> used in the API request is correct.</li><li>Check if the meal still exists in the meal plan and has not been deleted.</li></ul> |

### `MEAL_PLAN_ERROR_INVALID_SETTINGS`

| Description                                                                                                                             | API Services                                                                                                                                                                                                                               | Troubleshooting                                                                                                                                   |
| --------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| This error appears when you try to write meal plan settings for generating or updating a meal plan but the data specified is incorrect. | <p></p><ul><li><a href="../api/meal-plans/generate_mealplan">Generate a meal plan for a specific period.</a></li><li><a href="../api/meal-plans/get-meal-plan-settings/update-meal-plan-settings">Update meal plan settings.</a></li></ul> | <ul><li>Check <a href="../api/meal-plans/get-meal-plan-settings">Meal Plan Settings</a> to see if you have correctly defined the data. </li></ul> |

### `MEAL_PLAN_ERROR_WEEK_LIMIT_EXCEEDED`

| Description                                                               | API Services                           | Troubleshooting                                                                                         |
| ------------------------------------------------------------------------- | -------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| This error appears when you exceed the number of meals allowed in a week. | <p></p><p>Modify a batch of meals.</p> | Check if you already have 50 meals, which is the maximum number of meals you can have set for the week. |

### `RECIPE_ERROR_BAD_REQUEST`

| Description                                                         | API Services                                                                                                                                                                                                                                                                                                                                                                                    | Troubleshooting                                                                                                          |
| ------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| This error appears when your request contains incorrect parameters. | <p></p><ul><li><a href="../api/recipes/get-recipe-nutrition">Get a recipe by ID or URL.</a></li><li><a href="../api/recipes/recipe-search">Search recipes.</a></li><li><a href="../api/recipes/user-recipes-and-collections/add-user-recipe">Create or update a recipe.</a></li><li><a href="../api/recipes/user-recipes-and-collections/updaterecipe">Update an external recipe.</a></li></ul> | Check the [Recipe API](https://docs.whisk.com/api/recipes) documentation to see if your API request is correctly formed. |

### `RECIPE_ERROR_ALREADY_EXISTS`

| Description                                                                    | API Services                                                                                                       | Troubleshooting                                 |
| ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------- |
| This error appears when you try to add a recipe but the recipe already exists. | <p></p><p><a href="../api/recipes/user-recipes-and-collections/add-user-recipe">Create or update a recipe.</a></p> | You maybe adding a recipe that already existing |

### `RECIPE_ERROR_NOT_FOUND`

| Description                                                                                    | API Services                                                                                                                                                                                                                                                                                                                                                                              | Troubleshooting                                                                                                                                                                    |
| ---------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| This error appears when you try to read or edit a recipe's data but the recipe can't be found. | <p></p><ul><li><a href="../api/recipes/user-recipes-and-collections/add-user-recipe">Create or update a recipe.</a></li><li><a href="../api/recipes/user-recipes-and-collections/updaterecipe">Update an external recipe.</a></li><li><a href="../api/recipes/user-recipes-and-collections/remove-recipe-from-favorites">Delete a recipe from a specific recipe collection.</a></li></ul> | <p></p><ul><li>Check if the <code>recipe\_id</code> or recipe URL used in the API request is correct.</li><li>Check if the recipe still exists and has not been deleted.</li></ul> |

### `STORE_ITEM_ERROR_BAD_REQUEST`

| Description                                                                                              | API Services     | Troubleshooting                                                                                                            |
| -------------------------------------------------------------------------------------------------------- | ---------------- | -------------------------------------------------------------------------------------------------------------------------- |
| This error appears when you try to read store items data but your request contains incorrect parameters. | Get store items. | Check the [Store API](https://docs.whisk.com/api/store-item) documentation to see if your API request is correctly formed. |
