Skip to content

Error: RelayParser: Encountered duplicate defintitions for one or more documents #17811

Closed
@rgiese

Description

@rgiese

Description

Same issue as #11688; creating new issue since the previous one was marked as fixed with an attached code change.

Any Gatsby site can fail to build with the following error provided you're building on Windows and your CWD path is using a lower-case drive name:

 ERROR #85901  GRAPHQL

There was an error in your GraphQL query:

Error: RelayParser: Encountered duplicate defintitions for one or more documents: each document must have a unique name. Duplicated documents:
- eReposGrumpyv2GatsbyStarterBlogMdxSrcTemplatesBlogPostJs1876540457
- eReposGrumpyv2GatsbyStarterBlogMdxSrcPagesIndexJs4125737639

Steps to reproduce

  • Create a root directory for a new Gatsby site (e.g. e:\repos\grumpyv2) and make sure the Windows terminal shows the current path with a lower-case drive letter (clown around with something like cd /d e:\repos from a different drive letter to make sure it really is lowercase).

  • Clone my sample repo from https://github.com/rgiese/gatsby_issue17811, or just create a new Gatsby site that has a GraphQL query in one of its pages, e.g. gatsby new gatsby-starter-blog-mdx https://github.com/hagnerd/gatsby-starter-blog-mdx (which is all my sample repo is).

  • gatsby build

Expected result

The site builds.

Actual result

image

Environment

e:\repos\grumpyv2\gatsby-starter-blog-mdx>gatsby info --clipboard

  System:
    OS: Windows 10
    CPU: (16) x64 AMD Ryzen 7 2700X Eight-Core Processor
  Binaries:
    npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
  Languages:
    Python: 2.7.16
  Browsers:
    Edge: 44.18362.329.0
  npmPackages:
    gatsby: ^2.14.4 => 2.15.20
    gatsby-image: ^2.0.22 => 2.2.20
    gatsby-plugin-feed: ^2.0.8 => 2.3.13
    gatsby-plugin-google-analytics: ^2.0.5 => 2.1.17
    gatsby-plugin-manifest: ^2.0.5 => 2.2.18
    gatsby-plugin-mdx: ^1.0.33 => 1.0.43
    gatsby-plugin-offline: ^2.0.5 => 2.2.10
    gatsby-plugin-react-helmet: ^3.0.0 => 3.1.8
    gatsby-plugin-sharp: ^2.0.6 => 2.2.25
    gatsby-plugin-typography: ^2.2.0 => 2.3.8
    gatsby-remark-copy-linked-files: ^2.0.5 => 2.1.20
    gatsby-remark-images: ^3.1.19 => 3.1.23
    gatsby-remark-responsive-iframe: ^2.0.5 => 2.2.17
    gatsby-remark-smartypants: ^2.0.5 => 2.1.9
    gatsby-source-filesystem: ^2.0.2 => 2.1.26
    gatsby-transformer-remark: ^2.1.6 => 2.6.24
    gatsby-transformer-sharp: ^2.1.3 => 2.2.16

Thoughts on fixes

We should be able to just make this go away - someone's got to be using a non-Windows-enlightened path manipulation library somewhere.

Barring that, at least raise a more useful error message. This wasted three hours of my life yesterday and it's a pretty popular issue judging from Google (even since February when we last tried to fix it).

Metadata

Metadata

Assignees

No one assigned

    Labels

    stale?Issue that may be closed soon due to the original author not responding any more.type: bugAn issue or pull request relating to a bug in Gatsby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions