---
title: Error Handling
description: Sentinel errors returned by evaluation operations.
---

Sentinel defines sentinel errors in the root `sentinel` package. All errors are created with `errors.New` and can be checked with `errors.Is`.

## Store errors

| Error | Description |
|-------|-------------|
| `ErrNoStore` | No store was configured on the engine |
| `ErrStoreClosed` | The store has been closed |
| `ErrMigrationFailed` | Database migration failed |

## Not-found errors

| Error | Description |
|-------|-------------|
| `ErrSuiteNotFound` | Suite with the given ID does not exist |
| `ErrCaseNotFound` | Case with the given ID does not exist |
| `ErrRunNotFound` | Run with the given ID does not exist |
| `ErrBaselineNotFound` | Baseline with the given ID does not exist |
| `ErrPromptVersionNotFound` | Prompt version with the given ID does not exist |

## Conflict errors

| Error | Description |
|-------|-------------|
| `ErrSuiteAlreadyExists` | A suite with the same name already exists in this app |

## State errors

| Error | Description |
|-------|-------------|
| `ErrInvalidState` | Invalid state transition |
| `ErrEmptyInput` | Empty input provided |

## Evaluation errors

| Error | Description |
|-------|-------------|
| `ErrNoTarget` | No target configured for the evaluation |
| `ErrNoScorers` | No scorers configured for the case |

## Error wrapping

Store implementations wrap these sentinel errors with additional context:

```go
return fmt.Errorf("postgres: get suite %s: %w", suiteID, sentinel.ErrSuiteNotFound)
```

Check errors using `errors.Is`:

```go
s, err := eng.GetSuite(ctx, suiteID)
if errors.Is(err, sentinel.ErrSuiteNotFound) {
    // handle not found
}
```

## API error mapping

The HTTP API maps sentinel errors to HTTP status codes:

| Sentinel error | HTTP status |
|----------------|-------------|
| `ErrSuiteNotFound`, `ErrCaseNotFound`, etc. | `404 Not Found` |
| `ErrSuiteAlreadyExists` | `409 Conflict` |
| `ErrInvalidState`, `ErrEmptyInput` | `400 Bad Request` |
| `ErrNoStore` | `500 Internal Server Error` |
