# Class: MissingScopesError

Defined in: [api.ts:277](https://github.com/coda/packs-sdk/blob/b2b4c9dba5ca748bdbb94481cc13b5ca3c328ef6/api.ts#L277)

Throw this error if the user needs to re-authenticate to gain OAuth scopes that have been added to the pack since their connection was created, or scopes that are specific to a certain formula. This is useful because the platform will always attempt to execute a formula even if a user has not yet re-authenticated with all relevant scopes.

You don't *always* need to throw this specific error, as the platform will interpret a 403 (Forbidden) status code error as a MissingScopesError when the user's connection was made without all currently relevant scopes. This error exists because that default behavior is insufficient if the OAuth service does not set a 403 status code (the OAuth spec doesn't specifically require them to, after all).

## Example

```
try {
  let response = context.fetcher.fetch({
    // ...
  });
} catch (error) {
  // Determine if the error is due to missing scopes.
  if (error.statusCode == 400 && error.body?.message.includes("permission")) {
    throw new sdk.MissingScopesError();
  }
  // Else handle or throw the error as normal.
}
```

## See

- [Guide: Authenticating using OAuth](https://head.coda.io/packs/build/latest/guides/basics/authentication/oauth2/#triggering-a-prompt)

## Extends

- `Error`

## Properties

### name

> **name**: `string` = `'MissingScopesError'`

Defined in: [api.ts:281](https://github.com/coda/packs-sdk/blob/b2b4c9dba5ca748bdbb94481cc13b5ca3c328ef6/api.ts#L281)

The name of the error, for identification purposes.

#### Overrides

`Error.name`

## Methods

### isMissingScopesError()

> `static` **isMissingScopesError**(`err`): `err is MissingScopesError`

Defined in: [api.ts:289](https://github.com/coda/packs-sdk/blob/b2b4c9dba5ca748bdbb94481cc13b5ca3c328ef6/api.ts#L289)

Returns if the error is an instance of MissingScopesError. Note that `instanceof` may not work.

#### Parameters

| Parameter | Type | | --- | --- | | `err` | `any` |

#### Returns

`err is MissingScopesError`
