# Errors

A refused call raises an error with a stable `code`, the HTTP status, a message and sometimes `data`. TypeScript and Python have one class per code, so a test can catch exactly the refusal it expects. In Rust a refusal is `Error::Api { code, status, message, data }`, and `channelstack::codes` has each code as a constant to compare `code` with. channelstack's own codes are below; after them, the codes the fakes refuse with where the real platform refuses the same request.

## channelstack's codes

### action_requires

HTTP 422. A live action needs a piece live mode doesn't drive yet (the browser actor beyond typing and clicking, proxy mode), or one this run lacks (a real person to create a channel, team or page as, a saved browser session). A test is skipped for it.

SDK class: `ActionRequiresError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::ACTION_REQUIRES`.

Most methods can return it.

### cross_workspace_credential

HTTP 400. A person's token belongs to a different workspace than the app's.

SDK class: `CrossWorkspaceCredentialError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::CROSS_WORKSPACE_CREDENTIAL`.

Most methods can return it.

### fake_actor_in_live_world

HTTP 409. A fake person acts in a live workspace.

SDK class: `FakeActorInLiveWorldError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::FAKE_ACTOR_IN_LIVE_WORLD`.

Most methods can return it.

### internal

HTTP 500. Something failed inside channelstack. The message says what.

SDK class: `InternalError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::INTERNAL`.

Most methods can return it.

### invalid_argument

HTTP 400. An argument is missing, or has the wrong type or shape.

SDK class: `InvalidArgumentError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::INVALID_ARGUMENT`.

Most methods can return it.

### live_misconfigured

HTTP 412. Live mode is set up wrong: credentials set in part, a token of the wrong kind, a person without a token under `CHANNELSTACK_REALITY=live`. A test fails for it, so a broken nightly run goes red.

SDK class: `LiveMisconfiguredError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::LIVE_MISCONFIGURED`.

Most methods can return it.

### live_not_allowlisted

HTTP 403. The live workspace, org or team isn't in its `CHANNELSTACK_LIVE_*` allowlist. Nothing was done there.

SDK class: `LiveNotAllowlistedError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::LIVE_NOT_ALLOWLISTED`.

Most methods can return it.

### not_found

HTTP 404. The handle isn't there: it was removed, or belongs to another session.

SDK class: `NotFoundError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::NOT_FOUND`.

Most methods can return it.

### session_not_found

HTTP 404. The session was closed, or never existed.

SDK class: `SessionNotFoundError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::SESSION_NOT_FOUND`.

Most methods can return it.

### unauthorized

HTTP 401. The request has no valid bearer token: the one in `server.json`, or `CHANNELSTACK_TOKEN`.

SDK class: `UnauthorizedError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::UNAUTHORIZED`.

Most methods can return it.

### unsupported_in_fake

HTTP 501. The operation isn't built in the fake yet.

SDK class: `UnsupportedInFakeError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::UNSUPPORTED_IN_FAKE`.

Raised by [`SlackFixture.createChannel()`](https://channelstack.dev/docs/reference/api/slack#createchannel).

### unsupported_in_live

HTTP 501. The operation has no live counterpart, or not yet: delivery chaos, a person's Re-run. A test is skipped for it.

SDK class: `UnsupportedInLiveError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::UNSUPPORTED_IN_LIVE`.

Most methods can return it.

## Platform codes

The fakes refuse what the real platform refuses. Where the platform has its own error code, such as Slack's `not_in_channel`, the fake refuses with it. Where the platform answers with an HTTP status and no code of its own, such as GitHub's 403 and 422, the code is channelstack's name for the refusal (`forbidden`, `validation_failed`).

### account_inactive

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `AccountInactiveError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::ACCOUNT_INACTIVE`.

Raised by [`SlackFixture.createUser()`](https://channelstack.dev/docs/reference/api/slack#createuser), [`SlackFixture.uninstallApp()`](https://channelstack.dev/docs/reference/api/slack#uninstallapp).

### already_in_channel

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `AlreadyInChannelError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::ALREADY_IN_CHANNEL`.

Raised by [`SlackUser.invite()`](https://channelstack.dev/docs/reference/api/slack#invite).

### already_reacted

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `AlreadyReactedError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::ALREADY_REACTED`.

Raised by [`SlackApp.react()`](https://channelstack.dev/docs/reference/api/slack#react), [`SlackUser.react()`](https://channelstack.dev/docs/reference/api/slack#react-1).

### cannot_dm_bot

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `CannotDmBotError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::CANNOT_DM_BOT`.

Raised by [`SlackApp.say()`](https://channelstack.dev/docs/reference/api/slack#say).

### cannot_edit_others_message

The Discord fake refuses with it where the platform refuses the same request.

SDK class: `CannotEditOthersMessageError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::CANNOT_EDIT_OTHERS_MESSAGE`.

Raised by [`DiscordUser.edit()`](https://channelstack.dev/docs/reference/api/discord#edit).

### cannot_message_user

The Discord fake refuses with it where the platform refuses the same request.

SDK class: `CannotMessageUserError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::CANNOT_MESSAGE_USER`.

Raised by [`DiscordApp.say()`](https://channelstack.dev/docs/reference/api/discord#say).

### cant_delete_message

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `CantDeleteMessageError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::CANT_DELETE_MESSAGE`.

Raised by [`SlackUser.delete()`](https://channelstack.dev/docs/reference/api/slack#delete).

### cant_update_message

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `CantUpdateMessageError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::CANT_UPDATE_MESSAGE`.

Raised by [`SlackUser.edit()`](https://channelstack.dev/docs/reference/api/slack#edit).

### dispatch_failed

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `DispatchFailedError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::DISPATCH_FAILED`.

Raised by [`SlackUser.click()`](https://channelstack.dev/docs/reference/api/slack#click), [`SlackUser.select()`](https://channelstack.dev/docs/reference/api/slack#select), [`SlackUser.shortcut()`](https://channelstack.dev/docs/reference/api/slack#shortcut), [`SlackUser.runCommand()`](https://channelstack.dev/docs/reference/api/slack#runcommand), [`SlackModal.submit()`](https://channelstack.dev/docs/reference/api/slack#submit), [`SlackModal.close()`](https://channelstack.dev/docs/reference/api/slack#close).

### empty_message

The Discord fake refuses with it where the platform refuses the same request.

SDK class: `EmptyMessageError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::EMPTY_MESSAGE`.

Raised by [`DiscordApp.say()`](https://channelstack.dev/docs/reference/api/discord#say), [`DiscordApp.reply()`](https://channelstack.dev/docs/reference/api/discord#reply), [`DiscordUser.say()`](https://channelstack.dev/docs/reference/api/discord#say-1), [`DiscordUser.reply()`](https://channelstack.dev/docs/reference/api/discord#reply-1), [`DiscordUser.edit()`](https://channelstack.dev/docs/reference/api/discord#edit).

### forbidden

The GitHub, Linear and Notion fakes refuse with it where the platform refuses the same request.

SDK class: `ForbiddenError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::FORBIDDEN`.

Raised by [`GitHubApp.push()`](https://channelstack.dev/docs/reference/api/github#push), [`GitHubApp.openIssue()`](https://channelstack.dev/docs/reference/api/github#openissue), [`GitHubApp.openPullRequest()`](https://channelstack.dev/docs/reference/api/github#openpullrequest), [`GitHubApp.editIssue()`](https://channelstack.dev/docs/reference/api/github#editissue), [`GitHubApp.close()`](https://channelstack.dev/docs/reference/api/github#close), [`GitHubApp.reopen()`](https://channelstack.dev/docs/reference/api/github#reopen), [`GitHubApp.label()`](https://channelstack.dev/docs/reference/api/github#label), [`GitHubApp.unlabel()`](https://channelstack.dev/docs/reference/api/github#unlabel), [`GitHubApp.assign()`](https://channelstack.dev/docs/reference/api/github#assign), [`GitHubApp.comment()`](https://channelstack.dev/docs/reference/api/github#comment), [`GitHubApp.edit()`](https://channelstack.dev/docs/reference/api/github#edit), [`GitHubApp.delete()`](https://channelstack.dev/docs/reference/api/github#delete), and 51 more.

### invalid_auth

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `InvalidAuthError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::INVALID_AUTH`.

Raised by [`SlackFixture.createUser()`](https://channelstack.dev/docs/reference/api/slack#createuser).

### invalid_form_body

The Discord fake refuses with it where the platform refuses the same request.

SDK class: `InvalidFormBodyError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::INVALID_FORM_BODY`.

Raised by [`DiscordApp.say()`](https://channelstack.dev/docs/reference/api/discord#say), [`DiscordApp.reply()`](https://channelstack.dev/docs/reference/api/discord#reply), [`DiscordUser.say()`](https://channelstack.dev/docs/reference/api/discord#say-1), [`DiscordUser.reply()`](https://channelstack.dev/docs/reference/api/discord#reply-1), [`DiscordUser.edit()`](https://channelstack.dev/docs/reference/api/discord#edit).

### method_not_supported_for_channel_type

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `MethodNotSupportedForChannelTypeError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::METHOD_NOT_SUPPORTED_FOR_CHANNEL_TYPE`.

Raised by [`SlackUser.invite()`](https://channelstack.dev/docs/reference/api/slack#invite), [`SlackUser.kick()`](https://channelstack.dev/docs/reference/api/slack#kick).

### missing_access

The Discord fake refuses with it where the platform refuses the same request.

SDK class: `MissingAccessError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::MISSING_ACCESS`.

Raised by [`DiscordApp.say()`](https://channelstack.dev/docs/reference/api/discord#say), [`DiscordApp.reply()`](https://channelstack.dev/docs/reference/api/discord#reply), [`DiscordApp.react()`](https://channelstack.dev/docs/reference/api/discord#react), [`DiscordApp.unreact()`](https://channelstack.dev/docs/reference/api/discord#unreact), [`DiscordUser.say()`](https://channelstack.dev/docs/reference/api/discord#say-1), [`DiscordUser.reply()`](https://channelstack.dev/docs/reference/api/discord#reply-1).

### missing_permissions

The Discord fake refuses with it where the platform refuses the same request.

SDK class: `MissingPermissionsError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::MISSING_PERMISSIONS`.

Raised by [`DiscordApp.say()`](https://channelstack.dev/docs/reference/api/discord#say), [`DiscordApp.reply()`](https://channelstack.dev/docs/reference/api/discord#reply), [`DiscordApp.react()`](https://channelstack.dev/docs/reference/api/discord#react), [`DiscordApp.unreact()`](https://channelstack.dev/docs/reference/api/discord#unreact), [`DiscordUser.say()`](https://channelstack.dev/docs/reference/api/discord#say-1), [`DiscordUser.reply()`](https://channelstack.dev/docs/reference/api/discord#reply-1), [`DiscordUser.delete()`](https://channelstack.dev/docs/reference/api/discord#delete), [`DiscordUser.react()`](https://channelstack.dev/docs/reference/api/discord#react-1), [`DiscordUser.unreact()`](https://channelstack.dev/docs/reference/api/discord#unreact-1), [`DiscordUser.startThread()`](https://channelstack.dev/docs/reference/api/discord#startthread), [`DiscordUser.invite()`](https://channelstack.dev/docs/reference/api/discord#invite), [`DiscordUser.runCommand()`](https://channelstack.dev/docs/reference/api/discord#runcommand).

### msg_too_long

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `MsgTooLongError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::MSG_TOO_LONG`.

Raised by [`SlackApp.say()`](https://channelstack.dev/docs/reference/api/slack#say), [`SlackApp.reply()`](https://channelstack.dev/docs/reference/api/slack#reply), [`SlackUser.say()`](https://channelstack.dev/docs/reference/api/slack#say-1), [`SlackUser.reply()`](https://channelstack.dev/docs/reference/api/slack#reply-1).

### name_taken

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `NameTakenError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::NAME_TAKEN`.

Raised by [`SlackFixture.createChannel()`](https://channelstack.dev/docs/reference/api/slack#createchannel).

### no_reaction

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `NoReactionError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::NO_REACTION`.

Raised by [`SlackApp.unreact()`](https://channelstack.dev/docs/reference/api/slack#unreact), [`SlackUser.unreact()`](https://channelstack.dev/docs/reference/api/slack#unreact-1).

### no_text

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `NoTextError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::NO_TEXT`.

Raised by [`SlackApp.say()`](https://channelstack.dev/docs/reference/api/slack#say), [`SlackApp.reply()`](https://channelstack.dev/docs/reference/api/slack#reply), [`SlackUser.say()`](https://channelstack.dev/docs/reference/api/slack#say-1), [`SlackUser.reply()`](https://channelstack.dev/docs/reference/api/slack#reply-1), [`SlackUser.edit()`](https://channelstack.dev/docs/reference/api/slack#edit).

### not_allowed

The GitHub fake refuses with it where the platform refuses the same request.

SDK class: `NotAllowedError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::NOT_ALLOWED`.

Raised by [`GitHubApp.merge()`](https://channelstack.dev/docs/reference/api/github#merge), [`GitHubUser.merge()`](https://channelstack.dev/docs/reference/api/github#merge-1).

### not_in_channel

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `NotInChannelError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::NOT_IN_CHANNEL`.

Raised by [`SlackApp.say()`](https://channelstack.dev/docs/reference/api/slack#say), [`SlackApp.reply()`](https://channelstack.dev/docs/reference/api/slack#reply), [`SlackApp.react()`](https://channelstack.dev/docs/reference/api/slack#react), [`SlackApp.unreact()`](https://channelstack.dev/docs/reference/api/slack#unreact), [`SlackUser.say()`](https://channelstack.dev/docs/reference/api/slack#say-1), [`SlackUser.reply()`](https://channelstack.dev/docs/reference/api/slack#reply-1), [`SlackUser.edit()`](https://channelstack.dev/docs/reference/api/slack#edit), [`SlackUser.delete()`](https://channelstack.dev/docs/reference/api/slack#delete), [`SlackUser.click()`](https://channelstack.dev/docs/reference/api/slack#click), [`SlackUser.select()`](https://channelstack.dev/docs/reference/api/slack#select), [`SlackUser.shortcut()`](https://channelstack.dev/docs/reference/api/slack#shortcut), [`SlackUser.runCommand()`](https://channelstack.dev/docs/reference/api/slack#runcommand), and 7 more.

### object_not_found

The Notion fake refuses with it where the platform refuses the same request.

SDK class: `ObjectNotFoundError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::OBJECT_NOT_FOUND`.

Raised by [`NotionIntegration.comment()`](https://channelstack.dev/docs/reference/api/notion#comment), [`NotionIntegration.reply()`](https://channelstack.dev/docs/reference/api/notion#reply), [`NotionIntegration.edit()`](https://channelstack.dev/docs/reference/api/notion#edit), [`NotionIntegration.rename()`](https://channelstack.dev/docs/reference/api/notion#rename).

### restricted_resource

The Notion fake refuses with it where the platform refuses the same request.

SDK class: `RestrictedResourceError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::RESTRICTED_RESOURCE`.

Raised by [`NotionIntegration.comment()`](https://channelstack.dev/docs/reference/api/notion#comment), [`NotionIntegration.reply()`](https://channelstack.dev/docs/reference/api/notion#reply), [`NotionIntegration.edit()`](https://channelstack.dev/docs/reference/api/notion#edit), [`NotionIntegration.rename()`](https://channelstack.dev/docs/reference/api/notion#rename).

### split_view_unavailable

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `SplitViewUnavailableError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::SPLIT_VIEW_UNAVAILABLE`.

Raised by [`SlackUser.openAgentThread()`](https://channelstack.dev/docs/reference/api/slack#openagentthread), [`SlackUser.switchContext()`](https://channelstack.dev/docs/reference/api/slack#switchcontext).

### stop_unavailable

The Slack fake refuses with it where the platform refuses the same request.

SDK class: `StopUnavailableError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::STOP_UNAVAILABLE`.

Raised by [`SlackUser.stop()`](https://channelstack.dev/docs/reference/api/slack#stop).

### thread_already_created

The Discord fake refuses with it where the platform refuses the same request.

SDK class: `ThreadAlreadyCreatedError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::THREAD_ALREADY_CREATED`.

Raised by [`DiscordUser.startThread()`](https://channelstack.dev/docs/reference/api/discord#startthread).

### validation_error

The Notion fake refuses with it where the platform refuses the same request.

SDK class: `ValidationErrorError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::VALIDATION_ERROR`.

Raised by [`NotionIntegration.comment()`](https://channelstack.dev/docs/reference/api/notion#comment), [`NotionIntegration.reply()`](https://channelstack.dev/docs/reference/api/notion#reply), [`NotionIntegration.edit()`](https://channelstack.dev/docs/reference/api/notion#edit), [`NotionIntegration.rename()`](https://channelstack.dev/docs/reference/api/notion#rename).

### validation_failed

The GitHub fake refuses with it where the platform refuses the same request.

SDK class: `ValidationFailedError` in TypeScript and Python, a subclass of `ChannelstackError`. Rust: `Error::Api { code, .. }` with `code` equal to `codes::VALIDATION_FAILED`.

Raised by [`GitHubApp.openIssue()`](https://channelstack.dev/docs/reference/api/github#openissue), [`GitHubApp.openPullRequest()`](https://channelstack.dev/docs/reference/api/github#openpullrequest), [`GitHubApp.close()`](https://channelstack.dev/docs/reference/api/github#close), [`GitHubApp.reopen()`](https://channelstack.dev/docs/reference/api/github#reopen), [`GitHubApp.assign()`](https://channelstack.dev/docs/reference/api/github#assign), [`GitHubApp.review()`](https://channelstack.dev/docs/reference/api/github#review), [`GitHubApp.reviewComment()`](https://channelstack.dev/docs/reference/api/github#reviewcomment), [`GitHubApp.requestReview()`](https://channelstack.dev/docs/reference/api/github#requestreview), [`GitHubApp.markReady()`](https://channelstack.dev/docs/reference/api/github#markready), [`GitHubUser.openIssue()`](https://channelstack.dev/docs/reference/api/github#openissue-1), [`GitHubUser.openPullRequest()`](https://channelstack.dev/docs/reference/api/github#openpullrequest-1), [`GitHubUser.close()`](https://channelstack.dev/docs/reference/api/github#close-1), and 8 more.
