Skip to content

Duplicated type name error when running a single testย #4142

@rcybulski1122012

Description

@rcybulski1122012

Describe the Bug

In the project I'm working on we have a lots of types and we use strawberry.lazy very often. The application is functioning correctly, but sometimes there is a problem with running a single test (running all the tests works fine). An error is raised that some type is defined multiple times in the schema, but the error message indicates the same type twice.

Simplified error message:

  error: Type `UserFilter` is defined multiple times in the schema              
                                                                                
       @ core_api/core/schema/users/users_types.py:133                          
                                                                                
    132 | @strawberry_django.filter_type(User, lookups=True)                    
  โฑ 133 | class UserFilter:                              
                ^^^^^^^^^^ first class defined here                             
    134 |     email: auto                                                                                                               
                                                                                
       @ core_api/core/schema/users/users_types.py:133                          
                                                                                
    132 | @strawberry_django.filter_type(User, lookups=True)                    
  โฑ 133 | class UserFilter:                              
                ^^^^^^^^^^ second class defined here                            
    134 |     email: auto                                                                                                                  
                                                                                
                                                                                
  To fix this error you should either rename the type or remove the duplicated  
  definition.                                                                   
                                                                                
  Read more about this error on                                                 
  https://errors.strawberry.rocks/duplicated-type-name     

System Information

  • Operating system: MacOS 14.8
  • Python version: 3.12.8
  • Strawberry version (if applicable): 0.288.2

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions