Skip to content

fix(graphql): dedupe models across worlds when building schema - #434

Open
djizus wants to merge 1 commit into
dojoengine:mainfrom
djizus:fix/multi-world-graphql-duplicate-fields
Open

fix(graphql): dedupe models across worlds when building schema#434
djizus wants to merge 1 commit into
dojoengine:mainfrom
djizus:fix/multi-world-graphql-duplicate-fields

Conversation

@djizus

@djizus djizus commented Aug 3, 2026

Copy link
Copy Markdown

Summary

Fixes #433.

When torii indexes multiple worlds that register the same (namespace, name) model — e.g. several instances of one game deployed from the same code — build_objects() derives duplicate GraphQL field names and async-graphql panics (Field ... already exists), killing the whole process, indexer included.

This dedupes models by (namespace, name) when building the schema. World-scoped access remains available via SQL and gRPC; single-world deployments are unaffected (the dedupe is a no-op there).

Test

Adds a regression test that registers the same model under two world addresses and asserts the schema builds with the model field present.

  • Without the fix: panicked at async-graphql-7.0.11/src/dynamic/object.rs:82:9: Field multiworldTestDuplicateModels already exists
  • With the fix: test result: ok. 1 passed

Reproduced originally on torii v1.8.16 + katana v1.8.0-rc.9 with two sozo migrate runs of the same project under different seeds and one torii indexing both worlds. We run this patch in production.

🤖 Generated with Claude Code

When torii indexes multiple worlds that register the same
(namespace, name) model — e.g. several instances of one game deployed
from the same code — build_objects() derived duplicate GraphQL field
names and async-graphql panicked ("Field `...` already exists"),
killing the whole process, indexer included. Keep the first occurrence
of each model; world-scoped access remains available via SQL and gRPC,
and single-world deployments are unaffected.

Fixes dojoengine#433

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GraphQL server panics when indexing multiple worlds that register the same model names

1 participant