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

# SHOW INSPECT ERRORS

The `SHOW INSPECT ERRORS` [statement](/docs/stable/sql-statements.md) displays errors recorded by an [`INSPECT`](/docs/stable/inspect) job, including background `INSPECT` jobs triggered by [`IMPORT INTO`](/docs/stable/import-into) row count validation.

`SHOW INSPECT ERRORS` shows results for a single `INSPECT` job at a time; it does not aggregate results across jobs. To view errors from a specific job, including an `inspect_job_id` returned by [`IMPORT INTO`](/docs/stable/import-into), use `SHOW INSPECT ERRORS FOR JOB {job_id}`.

## Required privileges

To run `SHOW INSPECT ERRORS`, the user must have:

* The `INSPECT` system-level [privilege](/docs/stable/security-reference/authorization.md#supported-privileges), which is required to run the [`INSPECT` statement](/docs/stable/inspect).

## Synopsis

![show\_inspect\_errors syntax diagram](https://mintcdn.com/cockroachlabs/UZNSFbmU2EwEm6G5/images/sql-diagrams/common/show_inspect_errors.svg?fit=max\&auto=format\&n=UZNSFbmU2EwEm6G5\&q=85\&s=83e33d42cacb48729d055baa0fa03f52)

## Parameters

| Parameter | Syntax | Description |
| - | - | - |
| `opt_for_table_clause` | `FOR TABLE {table_name}` | Optional. Show errors for the specified [table](/docs/stable/create-table.md). |
| `opt_for_job_clause` | `FOR JOB {job_id}` | Optional. Show errors produced by the specified job ID, such as a job ID returned by the [`INSPECT` statement](/docs/stable/inspect) or the `inspect_job_id` returned by [`IMPORT INTO`](/docs/stable/import-into). |
| `opt_with_details` | `WITH DETAILS` | Optional. Include structured error metadata from the `details` column ([JSON](/docs/stable/jsonb.md)) in the results. |

## Response

`SHOW INSPECT ERRORS` returns the following columns, with one row per issue detected.

| Field | Description |
| - | - |
| `error_type` | The type of inconsistency detected. For more information, see [Error types](#error-types). |
| `database_name` | The [database](/docs/stable/create-database.md) containing the schema object with an issue. |
| `schema_name` | The [schema](/docs/stable/schema-design-overview.md) containing the object with an issue. |
| `table_name` | The [table](/docs/stable/create-table.md) with an issue. |
| `primary_key` | The [primary key](/docs/stable/primary-key.md) of the row involved in the issue, if applicable. |
| `job_id` | The ID of the [`INSPECT`](/docs/stable/inspect) job that detected the issue. |
| `aost` | The [`AS OF SYSTEM TIME`](/docs/stable/as-of-system-time) timestamp used by the validation [job](/docs/stable/show-jobs.md) (if any). |
| `details` | This column is present only if `WITH DETAILS` is specified. It contains structured metadata ([JSON](/docs/stable/jsonb.md)) describing the issue. |

### Error types

The `INSPECT` implementation reports the following `error_type` values:

| Error type | Meaning |
| - | - |
| `missing_secondary_index_entry` | A row in the [primary index](/docs/stable/primary-key.md) is missing a corresponding entry in a [secondary index](/docs/stable/indexes.md). If you see this error, [contact Support](/docs/stable/support-resources.md). |
| `dangling_secondary_index_entry` | A [secondary index](/docs/stable/indexes.md) entry exists, but the referenced [primary index](/docs/stable/primary-key.md) row does not. If you see this error, [contact Support](/docs/stable/support-resources.md). |
| `internal_error` | An error occurred while `INSPECT` was running its validation queries (for example, an [MVCC GC timeout](/docs/stable/ui-queues-dashboard.md#mvcc-gc-queue)). The cause of this error type is usually not related to data validity. Investigate the underlying job error details and cluster logs to determine the cause before deciding whether to [contact Support](/docs/stable/support-resources.md). |
| `row_count_mismatch` | The row count observed by `INSPECT` did not match the expected row count. This can occur in the post-import validation job triggered by [`IMPORT INTO`](/docs/stable/import-into). Use `WITH DETAILS` to compare the `expected` and `actual` counts. |
| `duplicate_unique_value` | `INSPECT` found a duplicate value in a supported [`REGIONAL BY ROW`](/docs/stable/alter-table) uniqueness check. Use `WITH DETAILS` to see the `index_name` and `remote_regions` metadata for the duplicate. |

## Examples

### Show the latest errors for a table

To see the errors found by the most recent `INSPECT` job, issue the following statement:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW INSPECT ERRORS FOR TABLE movr.public.users;
```

### Show errors for a specific inspection job

When you issue the [`INSPECT` statement](/docs/stable/inspect), a `NOTICE` message is returned to the client showing the job ID, e.g.,

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
INSPECT TABLE movr.public.users AS OF SYSTEM TIME '-10s';
```

```
NOTICE:  waiting for INSPECT job to complete: 1141477013029322753
If the statement is canceled, the job will continue in the background.
```

To show errors for a job, issue the following statement:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW INSPECT ERRORS FOR JOB 1141477013029322753;
```

If [`IMPORT INTO`](/docs/stable/import-into) returns an `inspect_job_id` value for its post-import validation job, you can use that value with `SHOW INSPECT ERRORS FOR JOB {inspect_job_id}` as well.

If there are no errors associated with that job ID, the output is:

```
SHOW INSPECT ERRORS 0
```

Note that if you issue a job ID for a nonexistent job, you will see the same output as for a job with no errors:

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW INSPECT ERRORS FOR JOB 0;
```

```
SHOW INSPECT ERRORS 0
```

### Show errors with details

```sql theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
SHOW INSPECT ERRORS FOR TABLE movr.public.users WITH DETAILS;
```

## See also

* [`INSPECT`](/docs/stable/inspect)
* [`SHOW JOBS`](/docs/stable/show-jobs)
* [Jobs page in DB Console](/docs/stable/ui-jobs-page.md)
* [Authorization](/docs/stable/security-reference/authorization.md#supported-privileges)
