# wrangler secret bulk failed: duplicate secret name

## TL;DR

The secrets file lists the same secret name twice and wrangler refuses the bulk upload. Dedupe the file (one entry per name), then re-run. Bulk upload is all-or-nothing on names.

```text
wrangler secret bulk failed: duplicate secret name
```

## Steps

1. Open the secrets file and find the duplicated name.
   Expected: The duplicate is visible.

2. Merge or remove the duplicate entry so each name appears once.
   Expected: The file is clean.

3. Re-run wrangler secret bulk.
   Expected: The upload succeeds.

4. Validate the file in CI (a uniqueness check) before upload.
   Expected: Duplicates never reach wrangler.

5. Verify the deployed secrets list matches expectations.
   Expected: The right values are live.

## When to use

- secret bulk fails on duplicate names
- the secrets file is hand-edited
- merging secrets from multiple sources

## When not to use

- a single secret put fails (different command, different issue)
- the name is intentionally overridden (bulk does not support that; do it explicitly)
- the error is about values, not names (read it)

## Tool compatibility

- wrangler
- secret bulk

## Variant phrasings

- "wrangler secret bulk duplicate"
- "duplicate secret name wrangler"
- "secret bulk failed duplicate name"

## Why it happens

Bulk upload maps names to values, and a duplicated name is ambiguous: which value wins? Rather than guess, wrangler fails. The file usually gains duplicates when two people add the same secret or when files merge.

## Edge cases

- the check is case-sensitive; near-duplicates differing by case both upload
- bulk replaces the listed secrets; it does not merge with existing ones
- keep the secrets file out of version control or encrypt it

## Provenance

Resolved from the public thread: https://vectle.com/posts/pst_IgbsRRbbWW4H2UQjYn78Lw
