Skip to content

Cannot query field \"site\" #39376

@SRD75

Description

@SRD75

Preliminary Checks

Description

In my local WP site -> GraphQL > GraphQL IDE, I have a query:

query HeaderQuery {
  site {
    siteMetadata {
      title
    }
  }

When I run this query, I receive an error:

"errors": [
    {
      "message": "Syntax Error: Expected Name, found <EOF>",
    }
]

If I use:

  site {
  }

I receive the same error.

Reproduction Link

https://github.com/gatsbyjs/gatsby/

Steps to Reproduce

  1. Open a local WordPress website
  2. Navigate to local WP site -> GraphQL > GraphQL IDE,
  3. Enter a query like
query HeaderQuery {
  site {
    siteMetadata {
      title
    }
  }
  wpMenu(name: {eq: "mainMenu"}) {
    menuItems {
      nodes {
        label
        url
        id
        childItems {
          nodes {
            url
            id
          }
        }
      }
    }
  }
  wpGatsby
}

See the error in the right pane.

Expected Result

Receive site meta information
siteMetadata {
title
}

Actual Result

Receive result on the right:

{
  "errors": [
    {
      "message": "Cannot query field \"site\" on type \"RootQuery\".",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ]
    }
  ],
  "extensions": {
    "debug": [
      {
        "type": "DEBUG_LOGS_INACTIVE",
        "message": "GraphQL Debug logging is not active. To see debug logs, GRAPHQL_DEBUG must be enabled."
      }
    ]
  }
}

Environment

System:
    OS: macOS 26.1
    CPU: (14) arm64 Apple M4 Pro
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.8.0 - ~/.nvm/versions/node/v22.8.0/bin/node
    npm: 10.8.2 - ~/.nvm/versions/node/v22.8.0/bin/npm
  Browsers:
    Chrome: 142.0.7444.176
    Safari: 26.1
  npmPackages:
    gatsby: ^5.14.6 => 5.15.0 
    gatsby-plugin-google-fonts: ^1.0.1 => 1.0.1 
    gatsby-plugin-image: ^3.14.0 => 3.15.0 
    gatsby-plugin-manifest: ^5.14.0 => 5.15.0 
    gatsby-plugin-sharp: ^5.14.0 => 5.15.0 
    gatsby-plugin-styled-components: ^6.15.0 => 6.15.0 
    gatsby-source-filesystem: ^5.14.0 => 5.15.0 
    gatsby-source-wordpress: ^7.16.0 => 7.16.0 
    gatsby-transformer-sharp: ^5.14.0 => 5.15.0 
  npmGlobalPackages:
    gatsby-cli: 5.15.0
    gatsby-core-utils: 4.15.0

Config Flags

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: triage neededIssue or pull request that need to be triaged and assigned to a reviewertype: 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