pub enum ShellError {
Show 70 variants OperatorMismatch { op_span: Span, lhs_ty: Type, lhs_span: Span, rhs_ty: Type, rhs_span: Span, }, OperatorOverflow(StringSpan), PipelineMismatch(StringSpanSpan), TypeMismatch(StringSpan), UnsupportedOperator(OperatorSpan), UnknownOperator(StringSpan), MissingParameter(StringSpan), IncompatibleParameters { left_message: String, left_span: Span, right_message: String, right_span: Span, }, DelimiterError(StringSpan), IncompatibleParametersSingle(StringSpan), FeatureNotEnabled(Span), ExternalNotSupported(Span), InvalidProbability(Span), InvalidRange(StringStringSpan), NushellFailed(String), NushellFailedSpanned(StringStringSpan), NushellFailedHelp(StringString), NushellFailedSpannedHelp(StringStringSpanString), VariableNotFoundAtRuntime(Span), EnvVarNotFoundAtRuntime(StringSpan), ModuleNotFoundAtRuntime(StringSpan), ModuleOrOverlayNotFoundAtRuntime(StringSpan), OverlayNotFoundAtRuntime(StringSpan), NotFound(Span), CantConvert(StringStringSpanOption<String>), EnvVarNotAString(StringSpan), DivisionByZero(Span), CannotCreateRange(Span), AccessBeyondEnd(usizeSpan), AccessBeyondEndOfStream(Span), IncompatiblePathAccess(StringSpan), CantFindColumn(SpanSpan), ColumnAlreadyExists(SpanSpan), NotAList(SpanSpan), ExternalCommand(StringStringSpan), UnsupportedInput(StringSpan), DatetimeParseError(Span), NetworkFailure(StringSpan), CommandNotFound(Span), FlagNotFound(StringSpan), FileNotFound(Span), FileNotFoundCustom(StringSpan), PluginFailedToLoad(String), PluginFailedToEncode(String), PluginFailedToDecode(String), IOError(String), NotADirectory(Span), DirectoryNotFound(SpanOption<String>), DirectoryNotFoundCustom(StringSpan), MoveNotPossible { source_message: String, source_span: Span, destination_message: String, destination_span: Span, }, MoveNotPossibleSingle(StringSpan), CreateNotPossible(StringSpan), ChangeAccessTimeNotPossible(StringSpan), ChangeModifiedTimeNotPossible(StringSpan), RemoveNotPossible(StringSpan), NoFileToBeRemoved(), NoFileToBeMoved(), NoFileToBeCopied(), ReadingFile(StringSpan), DidYouMean(StringSpan), NonUtf8(Span), DowncastNotPossible(StringSpan), UnsupportedConfigValue(StringStringSpan), MissingConfigValue(StringSpan), NeedsPositiveValue(Span), GenericError(StringStringOption<Span>, Option<String>, Vec<ShellError>), OutsideSpannedLabeledError(StringStringStringSpan), DeprecatedCommand(StringStringSpan), NonUnicodeInput, UnexpectedAbbrComponent(String),
}
Expand description

The fundamental error type for the evaluation engine. These cases represent different kinds of errors the evaluator might face, along with helpful spans to label. An error renderer will take this error value and pass it into an error viewer to display to the user.

Variants

OperatorMismatch

Fields

op_span: Span
lhs_ty: Type
lhs_span: Span
rhs_ty: Type
rhs_span: Span

An operator received two arguments of incompatible types.

Resolution

Check each argument’s type and convert one or both as needed.

OperatorOverflow(StringSpan)

An arithmetic operation’s resulting value overflowed its possible size.

Resolution

Check the inputs to the operation and add guards for their sizes. Integers are generally of size i64, floats are generally f64.

PipelineMismatch(StringSpanSpan)

The pipelined input into a command was not of the expected type. For example, it might expect a string input, but received a table instead.

Resolution

Check the relevant pipeline and extract or convert values as needed.

TypeMismatch(StringSpan)

A command received an argument of the wrong type.

Resolution

Convert the argument type before passing it in, or change the command to accept the type.

UnsupportedOperator(OperatorSpan)

This value cannot be used with this operator.

Resolution

Not all values, for example custom values, can be used with all operators. Either implement support for the operator on this type, or convert the type to a supported one.

UnknownOperator(StringSpan)

An operator was not recognized during evaluation.

Resolution

Did you write the correct operator?

MissingParameter(StringSpan)

An expected command parameter is missing.

Resolution

Add the expected parameter and try again.

IncompatibleParameters

Fields

left_message: String
left_span: Span
right_message: String
right_span: Span

Two parameters conflict with each other or are otherwise mutually exclusive.

Resolution

Remove one of the parameters/options and try again.

DelimiterError(StringSpan)

There’s some issue with number or matching of delimiters in an expression.

Resolution

Check your syntax for mismatched braces, RegExp syntax errors, etc, based on the specific error message.

IncompatibleParametersSingle(StringSpan)

An operation received parameters with some sort of incompatibility (for example, different number of rows in a table, incompatible column names, etc).

Resolution

Refer to the specific error message for details on what’s incompatible and then fix your inputs to make sure they match that way.

FeatureNotEnabled(Span)

This build of nushell implements this feature, but it has not been enabled.

Resolution

Rebuild nushell with the appropriate feature enabled.

ExternalNotSupported(Span)

You’re trying to run an unsupported external command.

Resolution

Make sure there’s an appropriate run-external declaration for this external command.

InvalidProbability(Span)

The given probability input is invalid. The probability must be between 0 and 1.

Resolution

Make sure the probability is between 0 and 1 and try again.

InvalidRange(StringStringSpan)

The first value in a .. range must be compatible with the second one.

Resolution

Check to make sure both values are compatible, and that the values are enumerable in Nushell.

NushellFailed(String)

Catastrophic nushell failure. This reflects a completely unexpected or unrecoverable error.

Resolution

It is very likely that this is a bug. Please file an issue at https://github.com/nushell/nushell/issues with relevant information.

NushellFailedSpanned(StringStringSpan)

Catastrophic nushell failure. This reflects a completely unexpected or unrecoverable error.

Resolution

It is very likely that this is a bug. Please file an issue at https://github.com/nushell/nushell/issues with relevant information.

NushellFailedHelp(StringString)

Catastrophic nushell failure. This reflects a completely unexpected or unrecoverable error.

Resolution

It is very likely that this is a bug. Please file an issue at https://github.com/nushell/nushell/issues with relevant information.

NushellFailedSpannedHelp(StringStringSpanString)

Catastrophic nushell failure. This reflects a completely unexpected or unrecoverable error.

Resolution

It is very likely that this is a bug. Please file an issue at https://github.com/nushell/nushell/issues with relevant information.

VariableNotFoundAtRuntime(Span)

A referenced variable was not found at runtime.

Resolution

Check the variable name. Did you typo it? Did you forget to declare it? Is the casing right?

EnvVarNotFoundAtRuntime(StringSpan)

A referenced environment variable was not found at runtime.

Resolution

Check the environment variable name. Did you typo it? Did you forget to declare it? Is the casing right?

ModuleNotFoundAtRuntime(StringSpan)

A referenced module was not found at runtime.

Resolution

Check the module name. Did you typo it? Did you forget to declare it? Is the casing right?

ModuleOrOverlayNotFoundAtRuntime(StringSpan)

A referenced module or overlay was not found at runtime.

Resolution

Check the module name. Did you typo it? Did you forget to declare it? Is the casing right?

OverlayNotFoundAtRuntime(StringSpan)

A referenced overlay was not found at runtime.

Resolution

Check the overlay name. Did you typo it? Did you forget to declare it? Is the casing right?

NotFound(Span)

The given item was not found. This is a fairly generic error that depends on context.

Resolution

This error is triggered in various places, and simply signals that “something” was not found. Refer to the specific error message for further details.

CantConvert(StringStringSpanOption<String>)

Failed to convert a value of one type into a different type.

Resolution

Not all values can be coerced this way. Check the supported type(s) and try again.

EnvVarNotAString(StringSpan)

An environment variable cannot be represented as a string.

Resolution

Not all types can be converted to environment variable values, which must be strings. Check the input type and try again.

DivisionByZero(Span)

Division by zero is not a thing.

Resolution

Add a guard of some sort to check whether a denominator input to this division is zero, and branch off if that’s the case.

CannotCreateRange(Span)

An error happened while tryin to create a range.

This can happen in various unexpected situations, for example if the range would loop forever (as would be the case with a 0-increment).

Resolution

Check your range values to make sure they’re countable and would not loop forever.

AccessBeyondEnd(usizeSpan)

You attempted to access an index beyond the available length of a value.

Resolution

Check your lengths and try again.

AccessBeyondEndOfStream(Span)

You attempted to access an index beyond the available length of a stream.

Resolution

Check your lengths and try again.

IncompatiblePathAccess(StringSpan)

Tried to index into a type that does not support pathed access.

Resolution

Check your types. Only composite types can be pathed into.

CantFindColumn(SpanSpan)

The requested column does not exist.

Resolution

Check the spelling of your column name. Did you forget to rename a column somewhere?

ColumnAlreadyExists(SpanSpan)

Attempted to insert a column into a table, but a column with that name already exists.

Resolution

Drop or rename the existing column (check rename -h) and try again.

NotAList(SpanSpan)

The given operation can only be performed on lists.

Resolution

Check the input type to this command. Are you sure it’s a list?

ExternalCommand(StringStringSpan)

An error happened while performing an external command.

Resolution

This error is fairly generic. Refer to the specific error message for further details.

UnsupportedInput(StringSpan)

An operation was attempted with an input unsupported for some reason.

Resolution

This error is fairly generic. Refer to the specific error message for further details.

DatetimeParseError(Span)

Failed to parse an input into a datetime value.

Resolution

Make sure your datetime input format is correct.

For example, these are some valid formats:

  • “5 pm”
  • “2020/12/4”
  • “2020.12.04 22:10 +2”
  • “2020-04-12 22:10:57 +02:00”
  • “2020-04-12T22:10:57.213231+02:00”
  • “Tue, 1 Jul 2003 10:52:37 +0200”“#

NetworkFailure(StringSpan)

A network operation failed.

Resolution

It’s always DNS.

CommandNotFound(Span)

Help text for this command could not be found.

Resolution

Check the spelling for the requested command and try again. Are you sure it’s defined and your configurations are loading correctly? Can you execute it?

FlagNotFound(StringSpan)

A flag was not found.

FileNotFound(Span)

Failed to find a file during a nushell operation.

Resolution

Does the file in the error message exist? Is it readable and accessible? Is the casing right?

FileNotFoundCustom(StringSpan)

Failed to find a file during a nushell operation.

Resolution

Does the file in the error message exist? Is it readable and accessible? Is the casing right?

PluginFailedToLoad(String)

A plugin failed to load.

Resolution

This is a failry generic error. Refer to the specific error message for further details.

PluginFailedToEncode(String)

A message from a plugin failed to encode.

Resolution

This is likely a bug with the plugin itself.

PluginFailedToDecode(String)

A message to a plugin failed to decode.

Resolution

This is either an issue with the inputs to a plugin (bad JSON?) or a bug in the plugin itself. Fix or report as appropriate.

IOError(String)

An I/O operation failed.

Resolution

This is a generic error. Refer to the specific error message for further details.

NotADirectory(Span)

Tried to cd to a path that isn’t a directory.

Resolution

Make sure the path is a directory. It currently exists, but is of some other type, like a file.

DirectoryNotFound(SpanOption<String>)

Attempted to perform an operation on a directory that doesn’t exist.

Resolution

Make sure the directory in the error message actually exists before trying again.

DirectoryNotFoundCustom(StringSpan)

Attempted to perform an operation on a directory that doesn’t exist.

Resolution

Make sure the directory in the error message actually exists before trying again.

MoveNotPossible

Fields

source_message: String
source_span: Span
destination_message: String
destination_span: Span

The requested move operation cannot be completed. This is typically because both paths exist, but are of different types. For example, you might be trying to overwrite an existing file with a directory.

Resolution

Make sure the destination path does not exist before moving a directory.

MoveNotPossibleSingle(StringSpan)

The requested move operation cannot be completed. This is typically because both paths exist, but are of different types. For example, you might be trying to overwrite an existing file with a directory.

Resolution

Make sure the destination path does not exist before moving a directory.

CreateNotPossible(StringSpan)

Failed to create either a file or directory.

Resolution

This is a fairly generic error. Refer to the specific error message for further details.

ChangeAccessTimeNotPossible(StringSpan)

Changing the access time (“atime”) of this file is not possible.

Resolution

This can be for various reasons, such as your platform or permission flags. Refer to the specific error message for more details.

ChangeModifiedTimeNotPossible(StringSpan)

Changing the modification time (“mtime”) of this file is not possible.

Resolution

This can be for various reasons, such as your platform or permission flags. Refer to the specific error message for more details.

RemoveNotPossible(StringSpan)

Unable to remove this item.

NoFileToBeRemoved()

NoFileToBeMoved()

NoFileToBeCopied()

ReadingFile(StringSpan)

Error while trying to read a file

Resolution

The error will show the result from a file operation

DidYouMean(StringSpan)

A name was not found. Did you mean a different name?

Resolution

The error message will suggest a possible match for what you meant.

NonUtf8(Span)

The given input must be valid UTF-8 for further processing.

Resolution

Check your input’s encoding. Are there any funny characters/bytes?

DowncastNotPossible(StringSpan)

A custom value could not be converted to a Dataframe.

Resolution

Make sure conversion to a Dataframe is possible for this value or convert it to a type that does, first.

UnsupportedConfigValue(StringStringSpan)

The value given for this configuration is not supported.

Resolution

Refer to the specific error message for details and convert values as needed.

MissingConfigValue(StringSpan)

An expected configuration value is not present.

Resolution

Refer to the specific error message and add the configuration value to your config file as needed.

NeedsPositiveValue(Span)

Negative value passed when positive ons is required.

Resolution

Guard against negative values or check your inputs.

GenericError(StringStringOption<Span>, Option<String>, Vec<ShellError>)

This is a generic error type used for different situations.

OutsideSpannedLabeledError(StringStringStringSpan)

This is a generic error type used for different situations.

DeprecatedCommand(StringStringSpan)

Attempted to use a deprecated command.

Resolution

Check the help for the new suggested command and update your script accordingly.

NonUnicodeInput

Non-Unicode input received.

Resolution

Check that your path is UTF-8 compatible.

UnexpectedAbbrComponent(String)

Unexpected abbr component.

Resolution

Check the path abbreviation to ensure that it is valid.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Unique diagnostic code that can be used to look up more information about this Diagnostic. Ideally also globally unique, and documented in the toplevel crate’s documentation for easy searching. Rust path format (foo::bar::baz) is recommended, but more classic codes like E0123 or enums will work just fine. Read more

Additional help text related to this Diagnostic. Do you have any advice for the poor soul who’s just run into this issue? Read more

Labels to apply to this Diagnostic’s Diagnostic::source_code

Source code to apply this Diagnostic’s Diagnostic::labels to.

Additional related Diagnostics.

URL to visit for a more detailed explanation/help about this Diagnostic. Read more

Diagnostic severity. This may be used by ReportHandlers to change the display format of this diagnostic. Read more

The cause of the error.

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Set the foreground color generically Read more

Set the background color generically. Read more

Change the foreground color to black

Change the background color to black

Change the foreground color to red

Change the background color to red

Change the foreground color to green

Change the background color to green

Change the foreground color to yellow

Change the background color to yellow

Change the foreground color to blue

Change the background color to blue

Change the foreground color to magenta

Change the background color to magenta

Change the foreground color to purple

Change the background color to purple

Change the foreground color to cyan

Change the background color to cyan

Change the foreground color to white

Change the background color to white

Change the foreground color to the terminal default

Change the background color to the terminal default

Change the foreground color to bright black

Change the background color to bright black

Change the foreground color to bright red

Change the background color to bright red

Change the foreground color to bright green

Change the background color to bright green

Change the foreground color to bright yellow

Change the background color to bright yellow

Change the foreground color to bright blue

Change the background color to bright blue

Change the foreground color to bright magenta

Change the background color to bright magenta

Change the foreground color to bright purple

Change the background color to bright purple

Change the foreground color to bright cyan

Change the background color to bright cyan

Change the foreground color to bright white

Change the background color to bright white

Make the text bold

Make the text dim

Make the text italicized

Make the text italicized

Make the text blink

Make the text blink (but fast!)

Swap the foreground and background colors

Hide the text

Cross out the text

Set the foreground color at runtime. Only use if you do not know which color will be used at compile-time. If the color is constant, use either OwoColorize::fg or a color-specific method, such as OwoColorize::green, Read more

Set the background color at runtime. Only use if you do not know what color to use at compile-time. If the color is constant, use either OwoColorize::bg or a color-specific method, such as OwoColorize::on_yellow, Read more

Set the foreground color to a specific RGB value.

Set the background color to a specific RGB value.

Sets the foreground color to an RGB value.

Sets the background color to an RGB value.

Apply a runtime-determined style

Converts the value of self to an instance of Hjson

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.