Simplify your stack and build anything. Or everything.
Build tomorrow’s web with a modern solution you truly own.
Code-based nature means you can build on top of it to power anything.
It’s time to take back your content infrastructure.

Error: Schema must contain uniquely named types but contains multiple types named "Media".

default discord avatar
taun2160last year
11
 F:\git\TaunDevs\payload\node_modules\graphql\type\schema.js:219
        throw new Error(
              ^
Error: Schema must contain uniquely named types but contains multiple types named "Media".
    at new GraphQLSchema (F:\git\TaunDevs\payload\node_modules\graphql\type\schema.js:219:15)
    at registerSchema (F:\git\TaunDevs\payload\node_modules\payload\src\graphql\registerSchema.ts:77:20)
    at BasePayload.init (F:\git\TaunDevs\payload\node_modules\payload\src\payload.ts:210:21)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at getPayload (F:\git\TaunDevs\payload\node_modules\payload\src\payload.ts:431:22)
    at initHTTP (F:\git\TaunDevs\payload\node_modules\payload\src\initHTTP.ts:25:19)
    at Payload.init (F:\git\TaunDevs\payload\node_modules\payload\src\index.ts:12:21)
[nodemon] app crashed - waiting for file changes before starting...


payload-types.ts


 


Should I be deleting a string of code within the payload-types.ts file? How does that file get modified? I didn't make any changes to it.



Found the file, though I haven't a clue what to do.



Or I'm not understanding the clue.



Anyone have an idea?

@1049775120559898725

?

  • default discord avatar
    notchrlast year

    Lets see



    @479030528084017165

    Try to regenerate your types first



    check the package.json, I think the command is

    generate:types

    you can also regenerate the graphqlschema via

    generate:graphQLSchema

    npm run generate:types

    (or yarn)



    Your app may be stuck in a state where you have two conflicting defs



    That's my first guess, let me know if that works

  • discord user avatar
    jmikrut
    last year

    so this is because you have two "things" called Media



    it could be a block and a collection

  • default discord avatar
    notchrlast year

    That was my second guess haha

  • discord user avatar
    jmikrut
    last year

    like, if you have a block with the slug of

    media

    and a collection with slug

    media

    , that will be a conflict

  • default discord avatar
    notchrlast year

    But I figured it would have complained prior to them reaching this error

  • discord user avatar
    jmikrut
    last year

    yeah, is this new? or a result of something you added?

  • default discord avatar
    taun2160last year

    I see, thanks guys



    I'm hacking together a mix of custom-website-series and payload-website, so this makes sense 😛

  • default discord avatar
    notchrlast year

    Happens to the best of us, let us know if you're able to solve it



    also

    @364124941832159242

    not to hijack the thread, but in core-dev i posted a question regarding default save behavior on fields because i encountered an oddity

  • discord user avatar
    jmikrut
    last year

    ok ill check that out right now

  • default discord avatar
    notchrlast year

    Thanks man! No rush btw, I'm close to wrapping up for the day

  • default discord avatar
    artmelkonlast year

    Hello, I'm having the same error: unhandledRejection Error: Schema must contain uniquely named types but contains multiple types named "Media". I copied the code from the GitHub repo "custom-website-series" and the slug media could be found twice One is in the collections/Media and the second one is in blocks/Media. When I change the slug in the blocks/Media to let us say I change the slug and types to "image" and regenerate payload-types and start the server I wouldn't get any error message but the browser wouldn't be able to load anything.

Star on GitHub

Star

Chat on Discord

Discord

online

Can't find what you're looking for?

Get dedicated engineering support directly from the Payload team.