---
sidebar:
  label: roboto.action_runtime.exceptions
  order: 1
title: roboto.action_runtime.exceptions
---
## Module Contents

### ActionRuntimeException

```python
exception roboto.action_runtime.exceptions.ActionRuntimeException
```

`from roboto.action_runtime import ActionRuntimeException`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/action_runtime/exceptions.py#L10-L28)

Bases: `Exception`

Base class of the exceptions the SDK raises when an action's environment lacks what the action asks for.

These methods of [`InvocationContext`](/docs/reference/python-sdk/roboto/action_runtime/invocation_context#roboto.action_runtime.invocation_context.InvocationContext) raise it:

- [`from_env()`](/docs/reference/python-sdk/roboto/action_runtime/invocation_context#roboto.action_runtime.invocation_context.InvocationContext.from_env), when a required environment variable is unset, or the input or output directory it names does not exist.
- [`dataset`](/docs/reference/python-sdk/roboto/action_runtime/invocation_context#roboto.action_runtime.invocation_context.InvocationContext.dataset), when the invocation has no dataset, as when the action runs locally, from a scheduled trigger, or from the CLI with query-based input data.
- [`get_input()`](/docs/reference/python-sdk/roboto/action_runtime/invocation_context#roboto.action_runtime.invocation_context.InvocationContext.get_input), when the environment names no input manifest.
- [`get_parameter()`](/docs/reference/python-sdk/roboto/action_runtime/invocation_context#roboto.action_runtime.invocation_context.InvocationContext.get_parameter) and [`get_secret_parameter()`](/docs/reference/python-sdk/roboto/action_runtime/invocation_context#roboto.action_runtime.invocation_context.InvocationContext.get_secret_parameter), when the parameter has no value.
- [`get_optional_parameter()`](/docs/reference/python-sdk/roboto/action_runtime/invocation_context#roboto.action_runtime.invocation_context.InvocationContext.get_optional_parameter) and the two methods above, when the file that holds the parameters or secrets cannot be read or does not hold a JSON object.

Outside Roboto's hosted compute environment, these usually mean the environment variables and files Roboto provides to an action were not set up. `PrepareEnvException` is the subclass raised while Roboto sets up an invocation.

### PrepareEnvException

```python
exception roboto.action_runtime.exceptions.PrepareEnvException(
    exit_code: roboto.action_runtime.exit_codes.ExitCode,
    reason: str,
)
```

`from roboto.action_runtime import PrepareEnvException`

[Source](https://github.com/roboto-ai/roboto-python-sdk/blob/main/src/roboto/action_runtime/exceptions.py#L31-L53)

Bases: [`ActionRuntimeException`](/docs/reference/python-sdk/roboto/action_runtime/exceptions#roboto.action_runtime.exceptions.ActionRuntimeException)

Roboto could not prepare an invocation's parameters or input data while setting up the invocation.

[`prepare_invocation_parameters()`](/docs/reference/python-sdk/roboto/action_runtime/prepare#roboto.action_runtime.prepare.prepare_invocation_parameters) raises it when a secret parameter names a secret that does not exist or that the invocation cannot read, and [`prepare_invocation_input_data()`](/docs/reference/python-sdk/roboto/action_runtime/prepare#roboto.action_runtime.prepare.prepare_invocation_input_data) raises it when the invocation's input data cannot be resolved. Roboto calls both when it sets up an invocation, and `roboto actions invoke-local` calls both to run an action on your computer. Roboto logs `reason` and ends the setup with `exit_code`.

**Parameters**

- **exit_code** (`roboto.action_runtime.exit_codes.ExitCode`)
- **reason** (`str`)

**Attributes**

- **PrepareEnvException.exit_code** (`roboto.action_runtime.exit_codes.ExitCode`): Exit code the invocation's setup ends with.
- **PrepareEnvException.reason** (`str`): What went wrong, as a message for the invocation's logs.
