> This page is for version 0.3.0.
> For other versions, use one of these documentation indexes:
> - Main (default): https://docs.nvidia.com/nemo/gym/main/llms.txt
> - 0.7.0: https://docs.nvidia.com/nemo/gym/v0.7.0/llms.txt
> - 0.6.0: https://docs.nvidia.com/nemo/gym/v0.6.0/llms.txt
> - 0.5.1: https://docs.nvidia.com/nemo/gym/v0.5.1/llms.txt
> - 0.5.0: https://docs.nvidia.com/nemo/gym/v0.5.0/llms.txt
> - 0.4.0: https://docs.nvidia.com/nemo/gym/v0.4.0/llms.txt
> - 0.3.0: https://docs.nvidia.com/nemo/gym/v0.3.0/llms.txt
> - 0.2.1: https://docs.nvidia.com/nemo/gym/v0.2.1/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/nemo/gym/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.nvidia.com/nemo/gym/_mcp/server.

# nemo_gym.server_runtime.request_handling.errors

Request validation errors: bounded, escaped logs of what was wrong, and the 422 response FastAPI returns.

## Module Contents

### Functions

| Name                                                                                                                  | Description                                                                                      |
| --------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
| [`_bounded_validation_error_value`](#nemo_gym-server_runtime-request_handling-errors-_bounded_validation_error_value) | -                                                                                                |
| [`_escaped_log_prefix`](#nemo_gym-server_runtime-request_handling-errors-_escaped_log_prefix)                         | Return a quoted, control-safe prefix bounded by `max_chars`.                                     |
| [`_escaped_log_text`](#nemo_gym-server_runtime-request_handling-errors-_escaped_log_text)                             | Return bounded, control-safe text with a visible marker when truncated.                          |
| [`_log_validation_exception`](#nemo_gym-server_runtime-request_handling-errors-_log_validation_exception)             | -                                                                                                |
| [`_validation_error_summaries`](#nemo_gym-server_runtime-request_handling-errors-_validation_error_summaries)         | -                                                                                                |
| [`_validation_errors_log_text`](#nemo_gym-server_runtime-request_handling-errors-_validation_errors_log_text)         | Render the error summaries for the log message, bounded by `_VALIDATION_ERROR_LOG_ERRORS_CHARS`. |
| [`_validation_exception_handler`](#nemo_gym-server_runtime-request_handling-errors-_validation_exception_handler)     | -                                                                                                |

### Data

[`_VALIDATION_ERROR_LOG_BODY_CHARS`](#nemo_gym-server_runtime-request_handling-errors-_VALIDATION_ERROR_LOG_BODY_CHARS)

[`_VALIDATION_ERROR_LOG_ERRORS_CHARS`](#nemo_gym-server_runtime-request_handling-errors-_VALIDATION_ERROR_LOG_ERRORS_CHARS)

[`_VALIDATION_ERROR_LOG_FIELD_CHARS`](#nemo_gym-server_runtime-request_handling-errors-_VALIDATION_ERROR_LOG_FIELD_CHARS)

[`_VALIDATION_ERROR_LOG_LOC_ITEMS`](#nemo_gym-server_runtime-request_handling-errors-_VALIDATION_ERROR_LOG_LOC_ITEMS)

[`_VALIDATION_ERROR_LOG_MAX_ERRORS`](#nemo_gym-server_runtime-request_handling-errors-_VALIDATION_ERROR_LOG_MAX_ERRORS)

[`logger`](#nemo_gym-server_runtime-request_handling-errors-logger)

### API

```python
nemo_gym.server_runtime.request_handling.errors._bounded_validation_error_value(
    value: typing.Any
) -> tuple[typing.Any, bool]
```

```python
nemo_gym.server_runtime.request_handling.errors._escaped_log_prefix(
    value: str,
    max_chars: int
) -> tuple[str, bool]
```

Return a quoted, control-safe prefix bounded by `max_chars`.

```python
nemo_gym.server_runtime.request_handling.errors._escaped_log_text(
    value: str,
    max_chars: int
) -> tuple[str, bool]
```

Return bounded, control-safe text with a visible marker when truncated.

```python
nemo_gym.server_runtime.request_handling.errors._log_validation_exception(
    request: fastapi.Request,
    exc: fastapi.exceptions.RequestValidationError
) -> None
```

async

```python
nemo_gym.server_runtime.request_handling.errors._validation_error_summaries(
    errors: list[dict[str, typing.Any]]
) -> tuple[list[dict[str, typing.Any]], bool]
```

```python
nemo_gym.server_runtime.request_handling.errors._validation_errors_log_text(
    error_summaries: list[dict[str, typing.Any]]
) -> tuple[str, bool]
```

Render the error summaries for the log message, bounded by `_VALIDATION_ERROR_LOG_ERRORS_CHARS`.

```python
nemo_gym.server_runtime.request_handling.errors._validation_exception_handler(
    request: fastapi.Request,
    exc: fastapi.exceptions.RequestValidationError
) -> fastapi.Response
```

async

```python
nemo_gym.server_runtime.request_handling.errors._VALIDATION_ERROR_LOG_BODY_CHARS = 4096
```

```python
nemo_gym.server_runtime.request_handling.errors._VALIDATION_ERROR_LOG_ERRORS_CHARS = 4096
```

```python
nemo_gym.server_runtime.request_handling.errors._VALIDATION_ERROR_LOG_FIELD_CHARS = 256
```

```python
nemo_gym.server_runtime.request_handling.errors._VALIDATION_ERROR_LOG_LOC_ITEMS = 8
```

```python
nemo_gym.server_runtime.request_handling.errors._VALIDATION_ERROR_LOG_MAX_ERRORS = 20
```

```python
nemo_gym.server_runtime.request_handling.errors.logger = logging.getLogger(__name__)
```