> ## Documentation Index
> Fetch the complete documentation index at: https://developers.datagrid.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Batch prediction errors

> Problem detail types returned by batch prediction endpoints and streamed result lines.

Batch prediction endpoints return RFC 9457 problem details (`application/problem+json`). The results stream also embeds the same shape inside each result line's `error` field when an individual item fails.

## Problem detail shape

```json theme={null}
{
  "type": "https://api.datagrid.com/errors/validation_failed",
  "title": "Validation Failed",
  "status": 422,
  "detail": "items must contain at least one item"
}
```

Validation errors include an `errors` array with JSON pointers into the request body. Item-level validation errors include `custom_id` when Datagrid can associate the issue with a submitted item.

```json theme={null}
{
  "type": "https://api.datagrid.com/errors/validation_failed",
  "title": "Validation Failed",
  "status": 422,
  "detail": "Duplicate custom_id 'drawing_001' in batch",
  "errors": [
    {
      "pointer": "/items/1/custom_id",
      "code": "duplicate_custom_id",
      "message": "Duplicate custom_id 'drawing_001' in batch",
      "custom_id": "drawing_001"
    }
  ]
}
```

## Error type registry

| Type URI                                                       | Where it appears                  | Meaning                                                                                                                                                                               |
| -------------------------------------------------------------- | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `https://api.datagrid.com/errors/no_authentication`            | Endpoint response                 | Missing, expired, or revoked API key.                                                                                                                                                 |
| `https://api.datagrid.com/errors/credit_exceeded`              | Endpoint response                 | The teamspace does not have enough credits to enqueue or continue batch work.                                                                                                         |
| `https://api.datagrid.com/errors/resource_not_found`           | Endpoint response                 | The batch does not exist in the authenticated teamspace.                                                                                                                              |
| `https://api.datagrid.com/errors/conflict`                     | Endpoint response                 | The request conflicts with current state, such as reusing an idempotency key with a different request body or cancelling a batch that is already `completed`, `failed`, or `expired`. |
| `https://api.datagrid.com/errors/results_gone`                 | Endpoint response                 | Batch metadata still exists, but retained result lines have already been cleaned up.                                                                                                  |
| `https://api.datagrid.com/errors/validation_failed`            | Endpoint response or batch object | Synchronous request validation failed before the batch was accepted, or asynchronous batch validation failed after creation.                                                          |
| `https://api.datagrid.com/errors/batch_validation_failed`      | Result line                       | Another item failed async validation, so this item was never processed.                                                                                                               |
| `https://api.datagrid.com/errors/file_not_found`               | Result line                       | The referenced file does not exist or is not accessible from the batch teamspace.                                                                                                     |
| `https://api.datagrid.com/errors/unsupported_file_format`      | Result line                       | The referenced file type cannot be processed by batch predictions, or a page reference was supplied for a non-paged file type.                                                        |
| `https://api.datagrid.com/errors/prediction_failed`            | Result line                       | Model execution completed, but the item could not be returned as a valid prediction.                                                                                                  |
| `https://api.datagrid.com/errors/batch_cancelled`              | Result line                       | The item did not run because the batch was cancelled.                                                                                                                                 |
| `https://api.datagrid.com/errors/batch_expired`                | Result line                       | The item did not run before the batch completion window expired.                                                                                                                      |
| `https://api.datagrid.com/errors/batch_item_processing_failed` | Result line                       | Item processing failed due to an internal execution error.                                                                                                                            |
| `https://api.datagrid.com/errors/rate_limit_exceeded`          | Endpoint response                 | The request was throttled or admission control rejected the create request.                                                                                                           |
| `https://api.datagrid.com/errors/internal_server_error`        | Endpoint response or result line  | An unexpected server-side error occurred.                                                                                                                                             |

## Example: rate-limited create request

```json theme={null}
{
  "type": "https://api.datagrid.com/errors/rate_limit_exceeded",
  "title": "Rate Limit Exceeded",
  "status": 429,
  "detail": "Too many batch prediction requests are already in progress for this teamspace."
}
```

When present, inspect `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`, `RateLimit-Policy`, `RateLimit`, and `Retry-After` response headers before retrying.

## Example: cleaned results

```json theme={null}
{
  "type": "https://api.datagrid.com/errors/results_gone",
  "title": "Results Gone",
  "status": 410,
  "detail": "Batch prediction results are no longer available because they were deleted after the retention period."
}
```

## Example: streamed item failure

```json theme={null}
{
  "object": "batch_prediction.result",
  "batch_id": "bpred_123",
  "custom_id": "drawing_002",
  "status": "errored",
  "output": null,
  "error": {
    "type": "https://api.datagrid.com/errors/file_not_found",
    "title": "File Not Found",
    "status": 422,
    "detail": "File 'file_missing' does not exist or is not accessible from this teamspace."
  }
}
```
