Build fail due to error in my GraphQL query

Field “category” is not defined by type MarkdownRemarkFrontmatterFilterInput. What does that mean, please advise.

I am using Netlify CMS as Content Manager with Gatsbyjs frontend. I am using this starter template https://github.com/netlify-templates/gatsby-starter-netlify-cms The way they have displayed tags I want to display category similarly so I copied its tag related files and replace the tag with category collection, also added category collection in config.yml file. Below is that code. Build error https://prnt.sc/sb6pwd The error is in the index.js file.

category.js That’s my template file to list all categories and the total blogs of that category

import React from 'react'
import { Helmet } from 'react-helmet'
import { Link, graphql } from 'gatsby'
import Layout from '../components/Layout'

class CategoryRoute extends React.Component {
  render() {
    const posts = this.props.data.allMarkdownRemark.edges
    const postLinks = posts.map((post) => (
      <li key={post.node.fields.slug}>
        <Link to={post.node.fields.slug}>
          <h2 className="is-size-2">{post.node.frontmatter.title}</h2>
        </Link>
      </li>
    ))
    const category = this.props.pageContext.category
    const title = this.props.data.site.siteMetadata.title
    const totalCount = this.props.data.allMarkdownRemark.totalCount
    const categoryHeader = `${totalCount} post${
      totalCount === 1 ? '' : 's'
    } tagged with “${category}”`

    return (
      <Layout>
        <section className="section">
          <Helmet title={`${category} | ${title}`} />
          <div className="container content">
            <div className="columns">
              <div
                className="column is-10 is-offset-1"
                style={{ marginBottom: '6rem' }}
              >
                <h3 className="title is-size-4 is-bold-light">{categoryHeader}</h3>
                <ul className="taglist">{postLinks}</ul>
                <p>
                  <Link to="/category/">Browse all category</Link>
                </p>
              </div>
            </div>
          </div>
        </section>
      </Layout>
    )
  }
}

export default CategoryRoute

export const categoryPageQuery = graphql`
  query CategoryPage($category: String) {
    site {
      siteMetadata {
        title
      }
    }
    allMarkdownRemark(
      limit: 1000
      sort: { fields: [frontmatter___date], order: DESC }
      filter: { frontmatter: { category: { in: [$category] } } }
    ) {
      totalCount
      edges {
        node {
          fields {
            slug
          }
          frontmatter {
            title

          }
        }
      }
    }
  }
`

index.js

import React from 'react'
import { kebabCase } from 'lodash'
import { Helmet } from 'react-helmet'
import { Link, graphql } from 'gatsby'
import Layout from '../../components/Layout'

const CategoryPage = ({
  data: {
    allMarkdownRemark: { group },
    site: {
      siteMetadata: { title },
    },
  },
}) => (
  <Layout>
    <section className="section">
      <Helmet title={`Category | ${title}`} />
      <div className="container content">
        <div className="columns">
          <div
            className="column is-10 is-offset-1"
            style={{ marginBottom: '6rem' }}
          >
            <h1 className="title is-size-2 is-bold-light">Categories</h1>
            <ul className="taglist">
              {group.map((category) => (
                <li key={category.fieldValue}>
                  <Link to={`/category/${kebabCase(category.fieldValue)}/`}>
                    {category.fieldValue} ({category.totalCount})
                  </Link>
                </li>
              ))}
            </ul>
          </div>
        </div>
      </div>
    </section>
  </Layout>
)

export default CategoryPage

export const categoryPageQuery = graphql`
  query CategoryQuery {
    site {
      siteMetadata {
        title
      }
    }
    allMarkdownRemark(limit: 1000) {
      group(field: frontmatter___category) {
        fieldValue
        totalCount
      }
    }
  }
`

Config.yml Category collection declaration:

- name: category
    label: Category
    identifier_field: slug
    folder: src/pages/blog/category
    create: true
    fields:
      -label: Template Key
       name: templateKey
       widget: hidden
       default: category
      - label: Category
        name: category
        widget: string
      - label: Category Image
        name: category_img
        widget: image
      - label: Slug
        name: slug
        widget: string
  - name: blog
    label: Blog
    folder: src/pages/blog
    create: true
    slug: "{{year}}-{{month}}-{{day}}-{{slug}}"
    fields:
      - label: Template Key
        name: templateKey
        widget: hidden
        default: blog-post
      - label: Title
        name: title
        widget: string
      - label: Path
        name: path
        widget: hidden
        default: blog-post
      - label: Publish Date
        name: date
        widget: datetime
      - label: Description
        name: description
        widget: text
      - label: Featured Post
        name: featuredpost
        widget: boolean
      - label: Featured Image
        name: featuredimage
        widget: image
      - label: Body
        name: body
        widget: markdown
      - label: Tags
        name: tags
        widget: list
      - label: Category
        name: category
        widget: select
        options:
          - label: Iraq
            value: iraq
          - label: Personal
            value: personal
          - label: Productivity
            value: productivity
          - label: Software Development
            value: software-development
          - label: Uncategorized
            value: uncategorized

anyone there to help me please!