Azure / Azure/data-api-builder
[Bug]: GraphQL Aliased Field Queries Cause Duplicate Dictionary Key Error for Same Entity
- Dominant language
- C#
- Stars
- 1.5k
- Forks
- 370
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 8
Description
### Discussed in https://github.com/Azure/data-api-builder/discussions/2785
Originally posted by **ascii1010** July 24, 2025
```graphql
brochure: books(
filter: { type: { eq: "brochure" } }
) {
items {
id
description
}
}
magazine: books(
filter: { type: { eq: "magazine" } }
) {
items {
id
description
}
}
```
The above generates error:
```
An item with the same key has already been added. Key: books
```
## Theory
The issue is not GraphQL itself. It is the resolver implementation using the entity name as the dictionary key instead of the alias or a unique field identifier. Two selections of books are valid GraphQL, but the server code is deduplicating by entity name and therefore treating them as a duplicate dictionary key.
Contributor guide
Assessment
This issue has not been assessed yet.