Skip to content

HC0065 error when multiple schema files contain overlapping type definitions #9837

Description

@andreashellquist

Product

Strawberry Shake

Version

15.1.16

Link to minimal reproduction

https://github.com/andreashellquist/strawberryshake-hc0065-repro

Steps to reproduce

Clone the repo
Run dotnet build in src/StrawberryShakeHC0065/
Build fails with HC0065
The project has two schema files (schema-part1.graphql and schema-part2.graphql) that both define input PageLinkComponentUpsertInput. This simulates CMS schemas (Hygraph/Contentful) where the CLI exports overlapping types across multiple files.

What is expected?

When multiple schema files contain identical type definitions, the code generator should deduplicate them and succeed. This is the standard scenario when working with CMS-exported schemas.

What is actually happening?

Build fails with:
error HC0065: The name PageLinkComponentUpsertInput was already registered by another type.

HotChocolate.SchemaException: For more details look at the Errors property.

  1. The name PageLinkComponentUpsertInput was already registered by another type.
    (HotChocolate.Types.InputObjectType)

Relevant log output

src/StrawberryShakeHC0065/StrawberryShakeHC0065.csproj : error HC0065: The name `PageLinkComponentUpsertInput` was already registered by another type.

Additional context

  • Root cause: SchemaHelper.Load calls builder.AddDocument(document) independently for each non-extension schema file. When files have overlapping type definitions, the HotChocolate type system registers the same type name twice.
  • Workaround: Manually consolidate all types into a single .graphql file (impractical for large CMS schemas with hundreds of types).
  • Affected versions: 14.x (confirmed on 14.4.0)
  • The issue also affects files containing both extension nodes and regular type definitions — regular types get silently dropped.

Metadata

Metadata

Assignees

No one assigned

    Type

    Fields

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions