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

# buildkit/DuplicateStageName

> Stage names in a multi-stage build should be unique.

Stage names in a multi-stage build should be unique.

| Property | Value |
| - | - |
| Severity | Error |
| Category | Correctness |
| Default | Enabled |

## Description

Defining multiple stages with the same name results in an error because the
builder is unable to uniquely resolve the stage name reference.

## Examples

Bad:

```dockerfile theme={null}
FROM debian:latest AS builder
RUN apt-get update; apt-get install -y curl

FROM golang:latest AS builder
```

Good:

```dockerfile theme={null}
FROM debian:latest AS deb-builder
RUN apt-get update; apt-get install -y curl

FROM golang:latest AS go-builder
```

## Supersedes

* [hadolint/DL3024](https://tally.wharflab.com/rules/hadolint/DL3024.md)

## Reference

* [buildkit/DuplicateStageName](https://docs.docker.com/reference/build-checks/duplicate-stage-name/)


## Related topics

- [BuildKit rules](https://tally.wharflab.com/rules/buildkit/overview.md)
- [hadolint/DL3024](https://tally.wharflab.com/rules/hadolint/DL3024.md)
- [Hadolint rules](https://tally.wharflab.com/rules/hadolint/overview.md)
- [buildkit/StageNameCasing](https://tally.wharflab.com/rules/buildkit/StageNameCasing.md)
- [buildkit/ReservedStageName](https://tally.wharflab.com/rules/buildkit/ReservedStageName.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.