# GetValidationError(int)

> Returns a specific graphics API validation error message by index.

## Definition

* **Type:** Method
* **Namespace:** [UnityEngine.Rendering](/engine/6000.7/script-reference/unityengine/rendering.md)
* **Assembly:** UnityEngine.CoreModule

```csharp
public static string GetValidationError(int index)
```

### Parameters

**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): The zero-based index of the error to retrieve. Valid values are in the range `[0, GetValidationErrorCount())`.

### Returns

| Type                                                           | Description                                                                       |
| -------------------------------------------------------------- | --------------------------------------------------------------------------------- |
| [string](https://learn.microsoft.com/dotnet/api/system.string) | The error message at the requested index, or `null` if the index is out of range. |

### Remarks

Call [GraphicsApiValidation.GetValidationErrorCount](/engine/6000.7/script-reference/unityengine/rendering/graphicsapivalidation/getvalidationerrorcount.md) first to determine the valid index range. Indices are stable for a given accumulation window and become invalid after a call to [GraphicsApiValidation.ClearValidationErrors](/engine/6000.7/script-reference/unityengine/rendering/graphicsapivalidation/clearvalidationerrors.md).

### Examples

```csharp
using UnityEngine;
using UnityEngine.Rendering;

public class Example : MonoBehaviour
{
    void LogFirstError()
    {
        if (GraphicsApiValidation.GetValidationErrorCount() == 0)
            return;

        string firstError = GraphicsApiValidation.GetValidationError(0);
        Debug.LogError($"First graphics API validation error: {firstError}");
    }
}
```
