Exceptions and Warnings

This section documents exceptions and warnings specific to commands extension.

Exceptions

exception disnake.ext.commands.CommandError(message=None, *args)[source]

The base exception type for all command related errors.

This inherits from disnake.DiscordException.

This exception and exceptions inherited from it are handled in a special way as they are caught and passed into a special event from Bot, on_command_error().

exception disnake.ext.commands.ConversionError(converter, original)[source]

Exception raised when a Converter class raises non-CommandError.

This inherits from CommandError.

converter

The converter that failed.

Type:

Converter

original

The original exception that was raised. You can also get this via the __cause__ attribute.

Type:

Exception

exception disnake.ext.commands.MissingRequiredArgument(param)[source]

Exception raised when parsing a command and a parameter that is required is not encountered.

This inherits from UserInputError

param

The argument that is missing.

Type:

inspect.Parameter

exception disnake.ext.commands.ArgumentParsingError(message=None, *args)[source]

An exception raised when the parser fails to parse a user’s input.

This inherits from UserInputError.

There are child classes that implement more granular parsing errors for i18n purposes.

exception disnake.ext.commands.UnexpectedQuoteError(quote)[source]

An exception raised when the parser encounters a quote mark inside a non-quoted string.

This inherits from ArgumentParsingError.

quote

The quote mark that was found inside the non-quoted string.

Type:

str

exception disnake.ext.commands.InvalidEndOfQuotedStringError(char)[source]

An exception raised when a space is expected after the closing quote in a string but a different character is found.

This inherits from ArgumentParsingError.

char

The character found instead of the expected string.

Type:

str

exception disnake.ext.commands.ExpectedClosingQuoteError(close_quote)[source]

An exception raised when a quote character is expected but not found.

This inherits from ArgumentParsingError.

close_quote

The quote character expected.

Type:

str

exception disnake.ext.commands.BadArgument(message=None, *args)[source]

Exception raised when a parsing or conversion failure is encountered on an argument to pass into a command.

This inherits from UserInputError

exception disnake.ext.commands.BadUnionArgument(param, converters, errors)[source]

Exception raised when a typing.Union converter fails for all its associated types.

This inherits from UserInputError

param

The parameter that failed being converted.

Type:

inspect.Parameter

converters

A tuple of converters attempted in conversion, in order of failure.

Type:

Tuple[Type, ...]

errors

A list of errors that were caught from failing the conversion.

Type:

List[CommandError]

exception disnake.ext.commands.BadLiteralArgument(param, literals, errors)[source]

Exception raised when a typing.Literal converter fails for all its associated values.

This inherits from UserInputError

New in version 2.0.

param

The parameter that failed being converted.

Type:

inspect.Parameter

literals

A tuple of values compared against in conversion, in order of failure.

Type:

Tuple[Any, ...]

errors

A list of errors that were caught from failing the conversion.

Type:

List[CommandError]

exception disnake.ext.commands.PrivateMessageOnly(message=None)[source]

Exception raised when an operation does not work outside of private message contexts.

This inherits from CheckFailure

exception disnake.ext.commands.NoPrivateMessage(message=None)[source]

Exception raised when an operation does not work in private message contexts.

This inherits from CheckFailure

exception disnake.ext.commands.CheckFailure(message=None, *args)[source]

Exception raised when the predicates in Command.checks or InvokableApplicationCommand.checks have failed.

This inherits from CommandError

exception disnake.ext.commands.CheckAnyFailure(checks, errors)[source]

Exception raised when all predicates in check_any() or app_check_any() fail.

This inherits from CheckFailure.

New in version 1.3.

errors

A list of errors that were caught during execution.

Type:

List[CheckFailure]

checks

A list of check predicates that failed.

Type:

List[Callable[[Union[Context, disnake.ApplicationCommandInteraction]], bool]]

exception disnake.ext.commands.CommandNotFound(message=None, *args)[source]

Exception raised when a command is attempted to be invoked but no command under that name is found.

This is not raised for invalid subcommands, rather just the initial main command that is attempted to be invoked.

This inherits from CommandError.

exception disnake.ext.commands.DisabledCommand(message=None, *args)[source]

Exception raised when the command being invoked is disabled.

This inherits from CommandError

exception disnake.ext.commands.CommandInvokeError(e)[source]

Exception raised when the command being invoked raised an exception.

This inherits from CommandError

original

The original exception that was raised. You can also get this via the __cause__ attribute.

Type:

Exception

exception disnake.ext.commands.TooManyArguments(message=None, *args)[source]

Exception raised when the command was passed too many arguments and its Command.ignore_extra attribute was not set to True.

This inherits from UserInputError

exception disnake.ext.commands.UserInputError(message=None, *args)[source]

The base exception type for errors that involve errors regarding user input.

This inherits from CommandError.

exception disnake.ext.commands.CommandOnCooldown(cooldown, retry_after, type)[source]

Exception raised when the command being invoked is on cooldown.

This inherits from CommandError

cooldown

A class with attributes rate and per similar to the cooldown() decorator.

Type:

Cooldown

type

The type associated with the cooldown.

Type:

BucketType

retry_after

The amount of seconds to wait before you can retry again.

Type:

float

exception disnake.ext.commands.MaxConcurrencyReached(number, per)[source]

Exception raised when the command being invoked has reached its maximum concurrency.

This inherits from CommandError.

number

The maximum number of concurrent invokers allowed.

Type:

int

per

The bucket type passed to the max_concurrency() decorator.

Type:

BucketType

exception disnake.ext.commands.NotOwner(message=None, *args)[source]

Exception raised when the message author is not the owner of the bot.

This inherits from CheckFailure

exception disnake.ext.commands.ObjectNotFound(argument)[source]

Exception raised when the argument provided did not match the format of an ID or a mention.

This inherits from BadArgument

New in version 2.0.

argument

The argument supplied by the caller that was not matched

Type:

str

exception disnake.ext.commands.MessageNotFound(argument)[source]

Exception raised when the message provided was not found in the channel.

This inherits from BadArgument

New in version 1.5.

argument

The message supplied by the caller that was not found

Type:

str

exception disnake.ext.commands.MemberNotFound(argument)[source]

Exception raised when the member provided was not found in the bot’s cache.

This inherits from BadArgument

New in version 1.5.

argument

The member supplied by the caller that was not found

Type:

str

exception disnake.ext.commands.GuildNotFound(argument)[source]

Exception raised when the guild provided was not found in the bot’s cache.

This inherits from BadArgument

New in version 1.7.

argument

The guild supplied by the called that was not found

Type:

str

exception disnake.ext.commands.UserNotFound(argument)[source]

Exception raised when the user provided was not found in the bot’s cache.

This inherits from BadArgument

New in version 1.5.

argument

The user supplied by the caller that was not found

Type:

str

exception disnake.ext.commands.ChannelNotFound(argument)[source]

Exception raised when the bot can not find the channel.

This inherits from BadArgument

New in version 1.5.

argument

The channel supplied by the caller that was not found

Type:

str

exception disnake.ext.commands.ChannelNotReadable(argument)[source]

Exception raised when the bot does not have permission to read messages in the channel.

This inherits from BadArgument

New in version 1.5.

argument

The channel supplied by the caller that was not readable

Type:

Union[abc.GuildChannel, Thread]

exception disnake.ext.commands.ThreadNotFound(argument)[source]

Exception raised when the bot can not find the thread.

This inherits from BadArgument

New in version 2.0.

argument

The thread supplied by the caller that was not found

Type:

str

exception disnake.ext.commands.BadColourArgument(argument)[source]

Exception raised when the colour is not valid.

This inherits from BadArgument

New in version 1.5.

argument

The colour supplied by the caller that was not valid

Type:

str

exception disnake.ext.commands.RoleNotFound(argument)[source]

Exception raised when the bot can not find the role.

This inherits from BadArgument

New in version 1.5.

argument

The role supplied by the caller that was not found

Type:

str

exception disnake.ext.commands.BadInviteArgument(argument)[source]

Exception raised when the invite is invalid or expired.

This inherits from BadArgument

New in version 1.5.

exception disnake.ext.commands.EmojiNotFound(argument)[source]

Exception raised when the bot can not find the emoji.

This inherits from BadArgument

New in version 1.5.

argument

The emoji supplied by the caller that was not found

Type:

str

exception disnake.ext.commands.PartialEmojiConversionFailure(argument)[source]

Exception raised when the emoji provided does not match the correct format.

This inherits from BadArgument

New in version 1.5.

argument

The emoji supplied by the caller that did not match the regex

Type:

str

exception disnake.ext.commands.GuildStickerNotFound(argument)[source]

Exception raised when the bot can not find the sticker.

This inherits from BadArgument

New in version 2.0.

argument

The sticker supplied by the caller that was not found

Type:

str

exception disnake.ext.commands.GuildScheduledEventNotFound(argument)[source]

Exception raised when the bot cannot find the scheduled event.

This inherits from BadArgument

New in version 2.5.

argument

The scheduled event ID/URL/name supplied by the caller that was not found.

Type:

str

exception disnake.ext.commands.BadBoolArgument(argument)[source]

Exception raised when a boolean argument was not convertable.

This inherits from BadArgument

New in version 1.5.

argument

The boolean argument supplied by the caller that is not in the predefined list

Type:

str

exception disnake.ext.commands.LargeIntConversionFailure(argument)[source]

Exception raised when a large integer argument was not able to be converted.

This inherits from BadArgument

New in version 2.5.

argument

The argument that could not be converted to an integer.

Type:

str

exception disnake.ext.commands.MissingPermissions(missing_permissions, *args)[source]

Exception raised when the command invoker lacks permissions to run a command.

This inherits from CheckFailure

missing_permissions

The required permissions that are missing.

Type:

List[str]

exception disnake.ext.commands.BotMissingPermissions(missing_permissions, *args)[source]

Exception raised when the bot’s member lacks permissions to run a command.

This inherits from CheckFailure

missing_permissions

The required permissions that are missing.

Type:

List[str]

exception disnake.ext.commands.MissingRole(missing_role)[source]

Exception raised when the command invoker lacks a role to run a command.

This inherits from CheckFailure

New in version 1.1.

missing_role

The required role that is missing. This is the parameter passed to has_role().

Type:

Union[str, int]

exception disnake.ext.commands.BotMissingRole(missing_role)[source]

Exception raised when the bot’s member lacks a role to run a command.

This inherits from CheckFailure

New in version 1.1.

missing_role

The required role that is missing. This is the parameter passed to has_role().

Type:

Union[str, int]

exception disnake.ext.commands.MissingAnyRole(missing_roles)[source]

Exception raised when the command invoker lacks any of the roles specified to run a command.

This inherits from CheckFailure

New in version 1.1.

missing_roles

The roles that the invoker is missing. These are the parameters passed to has_any_role().

Type:

List[Union[str, int]]

exception disnake.ext.commands.BotMissingAnyRole(missing_roles)[source]

Exception raised when the bot’s member lacks any of the roles specified to run a command.

This inherits from CheckFailure

New in version 1.1.

missing_roles

The roles that the bot’s member is missing. These are the parameters passed to has_any_role().

Type:

List[Union[str, int]]

exception disnake.ext.commands.NSFWChannelRequired(channel)[source]

Exception raised when a channel does not have the required NSFW setting.

This inherits from CheckFailure.

New in version 1.1.

Parameters:

channel (Union[abc.GuildChannel, Thread]) – The channel that does not have NSFW enabled.

exception disnake.ext.commands.FlagError(message=None, *args)[source]

The base exception type for all flag parsing related errors.

This inherits from BadArgument.

New in version 2.0.

exception disnake.ext.commands.BadFlagArgument(flag)[source]

An exception raised when a flag failed to convert a value.

This inherits from FlagError

New in version 2.0.

flag

The flag that failed to convert.

Type:

Flag

exception disnake.ext.commands.MissingFlagArgument(flag)[source]

An exception raised when a flag did not get a value.

This inherits from FlagError

New in version 2.0.

flag

The flag that did not get a value.

Type:

Flag

exception disnake.ext.commands.TooManyFlags(flag, values)[source]

An exception raised when a flag has received too many values.

This inherits from FlagError.

New in version 2.0.

flag

The flag that received too many values.

Type:

Flag

values

The values that were passed.

Type:

List[str]

exception disnake.ext.commands.MissingRequiredFlag(flag)[source]

An exception raised when a required flag was not given.

This inherits from FlagError

New in version 2.0.

flag

The required flag that was not found.

Type:

Flag

exception disnake.ext.commands.ExtensionError(message=None, *args, name)[source]

Base exception for extension related errors.

This inherits from DiscordException.

name

The extension that had an error.

Type:

str

exception disnake.ext.commands.ExtensionAlreadyLoaded(name)[source]

An exception raised when an extension has already been loaded.

This inherits from ExtensionError

exception disnake.ext.commands.ExtensionNotLoaded(name)[source]

An exception raised when an extension was not loaded.

This inherits from ExtensionError

exception disnake.ext.commands.NoEntryPointError(name)[source]

An exception raised when an extension does not have a setup entry point function.

This inherits from ExtensionError

exception disnake.ext.commands.ExtensionFailed(name, original)[source]

An exception raised when an extension failed to load during execution of the module or setup entry point.

This inherits from ExtensionError

name

The extension that had the error.

Type:

str

original

The original exception that was raised. You can also get this via the __cause__ attribute.

Type:

Exception

exception disnake.ext.commands.ExtensionNotFound(name)[source]

An exception raised when an extension is not found.

This inherits from ExtensionError

Changed in version 1.3: Made the original attribute always None.

name

The extension that had the error.

Type:

str

exception disnake.ext.commands.CommandRegistrationError(name, *, alias_conflict=False)[source]

An exception raised when the command can’t be added because the name is already taken by a different command.

This inherits from disnake.ClientException

New in version 1.4.

name

The command name that had the error.

Type:

str

alias_conflict

Whether the name that conflicts is an alias of the command we try to add.

Type:

bool

Exception Hierarchy

Warnings

class disnake.ext.commands.MessageContentPrefixWarning[source]

Warning for invalid prefixes without message content.

Warning Hierarchy