> ## 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.

`SHOW INSPECT ERRORS` shows results for a single `INSPECT` job at a time; it does not aggregate results across jobs. By default, it returns errors from the most recent completed, successful `INSPECT` job for the specified table. To view errors from a specific job, 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/tGEtnfk6iFpQGcmj/images/sql-diagrams/v26.1/show_inspect_errors.svg?fit=max&auto=format&n=tGEtnfk6iFpQGcmj&q=85&s=3f130934b19c4d438bf933964bdc10de" alt="show_inspect_errors syntax diagram" style={{maxWidth: "100%", overflowX: "auto"}} width="649" height="103" data-path="images/sql-diagrams/v26.1/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 job ID returned by the <InternalLink path="inspect">`INSPECT` statement</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                                                                                                                                                                |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `job\_id`        | The ID of the <InternalLink path="inspect">`INSPECT`</InternalLink> job that detected the issue.                                                                           |
| `error\_type`    | The type of inconsistency detected. For more information, see [Error types](#error-types).                                                                                 |
| `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). |
| `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.                                                                 |
| `object\_name`   | The <InternalLink path="create-table">table</InternalLink> or <InternalLink path="indexes">index</InternalLink> with an issue.                                             |
| `primary\_key`   | The <InternalLink path="primary-key">primary key</InternalLink> of the row involved in the issue, if applicable.                                                           |
| `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>. |

## 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';
```

```text theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
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 there are no errors associated with that job ID, the output is:

```text theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
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;
```

```text theme={"theme":{"light":"catppuccin-mocha","dark":"catppuccin-mocha"}}
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>
