> ## Documentation Index
> Fetch the complete documentation index at: https://developer.box.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Common errors

export const Link = ({href, children, className, ...props}) => {
  const localizedHref = href;
  return <a href={localizedHref} className={className} {...props}>
      {children}
    </a>;
};

Metadata query API errors mostly are <Link href="/guides/api-calls/permissions-and-errors/common-errors">similar to errors returned by other
APIs</Link>, however at this time some incorrect client requests may result in
a server-side error with a HTTP status code in the `5XX` range rather than an
appropriate `400 Bad Request` error.

This is a known issue which will be addressed soon.

## Incorrect template key and scope

A common error is to use an incorrect value for the the `from` value in the
request, which can result in various errors in the `HTTP 4XX` range.

Without a correct `from` value the API does not know what template to search
for. The value in `from` must be formed as `scope.templateKey`.

In this case `scope` is your enterprise's template scope, which looks something
like `enterprise_123456`. The numeric value here is your enterprise's ID. Any
scope that does not match this format, including the `global` scope and the
`enterprise` shorthand scope, will return an error.

The `templateKey` is the unique key for the metadata template within your
enterprise. The API returns an error when a template with the given key does not
exist, or when the key is used within the wrong enterprise were the key does not
exist.

<Note>
  The <Link href="/reference/get-metadata-templates-enterprise">List all metadata templates for enterprise endpoint</Link>
  can be used to list all templates available in your enterprise,
  including their `scope` and `templateKey`.
</Note>

## Missing value in `query_param`

A common error is to forget to include a query argument in the `query_params`
object, which results in a `HTTP 400` error with a code of
`unexpected_json_type`.

Without all arguments present in the `query_params` the API can not compile your
request into a full query.

For example, assume your search `query` is as follows
`amount >= :value AND status = :status`. All of the arguments that start with a
colon `:` will need to be present in the `query_params`. In this case your query
parameters would have to look something like this. Missing out on any of these
values will result in an error.

```json theme={null}
"query_params": {
  "value": 100,
  "status": "active"
}
```

<Note>
  The name of each argument can configured to your liking and does not need to
  match the field key. The only requirement is that it starts with a `:`.
</Note>

## Missing `ancestor_folder_id`

A common error is to forget the `ancestor_folder_id` in the request, which
results in a `HTTP 400` error with a code of `bad_request`.

Without the `ancestor_folder_id` value the API does not know what folder to
search for results in. When in doubt a value of `0` can be used for the user's
root folder.
