Skip to content

DuplicatedTypeName Exception after Upgrade #845

@truesang

Description

@truesang

After upgrading from v0.70.1 to the latest v0.73.1, I'm getting DuplicatedTypeName exception during Django startup:

strawberry.exceptions.duplicated_type_name.DuplicatedTypeName: Type StrFilterLookup is defined multiple times in the schema

Describe the Bug

I don't believe I have any custom StrFilterLookups in the project. It looks like the v0.71.0 is the first version I'd get this exceptions.

System Information

  • Operating system: Debian
  • Python version: 3.13.9

Additional Context

Traceback (most recent call last):
  File "/usr/local/lib/python3.13/threading.py", line 1043, in _bootstrap_inner
    self.run()
    ~~~~~~~~^^
  File "/usr/local/lib/python3.13/threading.py", line 994, in run
    self._target(*self._args, **self._kwargs)
    ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/django/utils/autoreload.py", line 64, in wrapper
    fn(*args, **kwargs)
    ~~^^^^^^^^^^^^^^^^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/django/core/management/commands/runserver.py", line 134, in inner_run
    self.check(**check_kwargs)
    ~~~~~~~~~~^^^^^^^^^^^^^^^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/django/core/management/base.py", line 496, in check
    all_issues = checks.run_checks(
        app_configs=app_configs,
    ...<2 lines>...
        databases=databases,
    )
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/django/core/checks/registry.py", line 89, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/django/core/checks/urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/django/core/checks/urls.py", line 26, in check_resolver
    return check_method()
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/django/urls/resolvers.py", line 531, in check
    for pattern in self.url_patterns:
                   ^^^^^^^^^^^^^^^^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/django/utils/functional.py", line 47, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
                                         ~~~~~~~~~^^^^^^^^^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/django/urls/resolvers.py", line 718, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
                       ^^^^^^^^^^^^^^^^^^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/django/utils/functional.py", line 47, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
                                         ~~~~~~~~~^^^^^^^^^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/django/urls/resolvers.py", line 711, in urlconf_module
    return import_module(self.urlconf_name)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1027, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/home/apps/app1/app/urls.py", line 26, in <module>
    from .schema import PrivateGraphQLView, schema
  File "/home/apps/app1/app/schema.py", line 19, in <module>
    schema = strawberry.Schema(
        query=Query,
        types=additional_types,
        extensions=[DjangoOptimizerExtension],
    )
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/strawberry/schema/schema.py", line 351, in __init__
    raise error.__cause__ from None
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/graphql/type/definition.py", line 1495, in fields
    fields = resolve_thunk(self._fields)
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/graphql/type/definition.py", line 318, in resolve_thunk
    return thunk() if callable(thunk) else thunk
           ~~~~~^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/strawberry/schema/schema_converter.py", line 531, in <lambda>
    fields=lambda: self.get_graphql_input_fields(type_definition),
                   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/strawberry/schema/schema_converter.py", line 488, in get_graphql_input_fields
    return _get_thunk_mapping(
        type_definition=type_definition,
    ...<2 lines>...
        get_fields=self.get_fields,
    )
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/strawberry/schema/schema_converter.py", line 143, in _get_thunk_mapping
    thunk_mapping[name_converter(field)] = field_converter(
                                           ~~~~~~~~~~~~~~~^
        field,
        ^^^^^^
        type_definition=type_definition,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/strawberry/schema/schema_converter.py", line 453, in from_input_field
    self.from_maybe_optional(
    ~~~~~~~~~~~~~~~~~~~~~~~~^
        field.resolve_type(type_definition=type_definition)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ),
    ^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/strawberry/schema/schema_converter.py", line 866, in from_maybe_optional
    return self.from_type(type_.of_type)
           ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/strawberry/schema/schema_converter.py", line 882, in from_type
    return self.from_input_object(type_)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/strawberry/schema/schema_converter.py", line 503, in from_input_object
    self.validate_same_type_definition(type_name, type_definition, cached_type)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/apps/app1/.venv/lib/python3.13/site-packages/strawberry/schema/schema_converter.py", line 1040, in validate_same_type_definition
    raise DuplicatedTypeName(first_origin, second_origin, name)
strawberry.exceptions.duplicated_type_name.DuplicatedTypeName: Type StrFilterLookup is defined multiple times in the schema

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingquestionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions