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

# SHOW INSPECT ERRORS

export const InternalLink = ({version, path = "", children, ...props}) => {
  let detectedVersion = version || "stable";
  if (typeof window !== 'undefined' && !version) {
    const match = window.location.pathname.match(/\/docs\/([^/]+)/);
    if (match) {
      detectedVersion = match[1];
    }
  }
  const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
  return <a href={`/docs/${detectedVersion}/${normalizedPath}`} {...props}>
      {children}
    </a>;
};

The `SHOW INSPECT ERRORS` <InternalLink path="sql-statements">statement</InternalLink> displays errors recorded by an <InternalLink path="inspect">`INSPECT`</InternalLink> job, including background `INSPECT` jobs triggered by <InternalLink path="import-into">`IMPORT INTO`</InternalLink> 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 <InternalLink path="import-into">`IMPORT INTO`</InternalLink>, use `SHOW INSPECT ERRORS FOR JOB {job_id}`.

## Required privileges

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

* The `INSPECT` system-level <InternalLink path="security-reference/authorization#supported-privileges">privilege</InternalLink>, which is required to run the <InternalLink path="inspect">`INSPECT` statement</InternalLink>.

## Synopsis

<img src="https://mintcdn.com/cockroachlabs/8savutSe7Roc6oQ0/images/sql-diagrams/v26.2/show_inspect_errors.svg?fit=max&auto=format&n=8savutSe7Roc6oQ0&q=85&s=1db99dd768c24729d3a1b565377b571f" alt="show_inspect_errors syntax diagram" style={{maxWidth: "100%", overflowX: "auto"}} width="649" height="103" data-path="images/sql-diagrams/v26.2/show_inspect_errors.svg" />

## Parameters

| Parameter              | Syntax                   | Description                                                                                                                                                                                                                                                 |
| ---------------------- | ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `opt_for_table_clause` | `FOR TABLE {table_name}` | Optional. Show errors for the specified <InternalLink path="create-table">table</InternalLink>.                                                                                                                                                             |
| `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 <InternalLink path="inspect">`INSPECT` statement</InternalLink> or the `inspect_job_id` returned by <InternalLink path="import-into">`IMPORT INTO`</InternalLink>. |
| `opt_with_details`     | `WITH DETAILS`           | Optional. Include structured error metadata from the `details` column (<InternalLink path="jsonb">JSON</InternalLink>) 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 <InternalLink path="create-database">database</InternalLink> containing the schema object with an issue.                                                               |
| `schema_name`   | The <InternalLink path="schema-design-overview">schema</InternalLink> containing the object with an issue.                                                                 |
| `table_name`    | The <InternalLink path="create-table">table</InternalLink> with an issue.                                                                                                  |
| `primary_key`   | The <InternalLink path="primary-key">primary key</InternalLink> of the row involved in the issue, if applicable.                                                           |
| `job_id`        | The ID of the <InternalLink path="inspect">`INSPECT`</InternalLink> job that detected the issue.                                                                           |
| `aost`          | The <InternalLink path="as-of-system-time">`AS OF SYSTEM TIME`</InternalLink> timestamp used by the validation <InternalLink path="show-jobs">job</InternalLink> (if any). |
| `details`       | This column is present only if `WITH DETAILS` is specified. It contains structured metadata (<InternalLink path="jsonb">JSON</InternalLink>) 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 <InternalLink path="primary-key">primary index</InternalLink> is missing a corresponding entry in a <InternalLink path="indexes">secondary index</InternalLink>. If you see this error, <InternalLink path="support-resources">contact Support</InternalLink>.                                                                                                                                                                |
| `dangling_secondary_index_entry` | A <InternalLink path="indexes">secondary index</InternalLink> entry exists, but the referenced <InternalLink path="primary-key">primary index</InternalLink> row does not. If you see this error, <InternalLink path="support-resources">contact Support</InternalLink>.                                                                                                                                                                   |
| `internal_error`                 | An error occurred while `INSPECT` was running its validation queries (for example, an <InternalLink path="ui-queues-dashboard#mvcc-gc-queue">MVCC GC timeout</InternalLink>). 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 <InternalLink path="support-resources">contact Support</InternalLink>. |
| `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 <InternalLink path="import-into">`IMPORT INTO`</InternalLink>. Use `WITH DETAILS` to compare the `expected` and `actual` counts.                                                                                                                                                                   |
| `duplicate_unique_value`         | `INSPECT` found a duplicate value in a supported <InternalLink path="alter-table">`REGIONAL BY ROW`</InternalLink> 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 <InternalLink path="inspect">`INSPECT` statement</InternalLink>, 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 <InternalLink path="import-into">`IMPORT INTO`</InternalLink> 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

* <InternalLink path="inspect">`INSPECT`</InternalLink>
* <InternalLink path="show-jobs">`SHOW JOBS`</InternalLink>
* <InternalLink path="ui-jobs-page">Jobs page in DB Console</InternalLink>
* <InternalLink path="security-reference/authorization#supported-privileges">Authorization</InternalLink>
