---
title: "swapped-errors-is-arguments"
description: "Detect likely reversed errors.Is arguments."
image: "https://strider.gempir.com/og.png"
---

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

# swapped-errors-is-arguments

**Default severity:** `error`

`errors.Is` expects the error being inspected first and the target sentinel
second. A package-level sentinel from another package in the first position,
followed by a local error value, usually means the arguments were reversed.

## Bad

```go
errors.Is(io.EOF, err)
```

## Good

```go
errors.Is(err, io.EOF)
```

Source: https://strider.gempir.com/analyzers/swapped-errors-is-arguments/index.mdx
