# Gettig error ./apollo-ios-cli generate

**URL:** <https://community.apollographql.com/t/gettig-error-apollo-ios-cli-generate/7560>\
**Category:** Client SDKs\
**Tags:** ios\
**Created:** [May 27, 2024, 9:22pm UTC](https://community.apollographql.com/t/gettig-error-apollo-ios-cli-generate/7560 "2024-05-27T21:22:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yeshua\_A](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/yeshua_a/32/5126_2.png) [@Yeshua\_A](https://community.apollographql.com/u/Yeshua_A)\
**Post date:** [May 27, 2024, 9:22pm UTC](https://community.apollographql.com/t/gettig-error-apollo-ios-cli-generate/7560/1 "2024-05-27T21:22:25Z")

</div>

I am following this tutorial: [iOS GraphQL Simplified: macOS Command Line Techniques for Sustainable Schema Operations | by Alkin Cakiralar | Medium](https://medium.com/@acakiralar/ios-graphql-simplified-macos-command-line-techniques-for-sustainable-schema-operations-22921d436f74) and I am getting an error when using the `generate` command. It seems to be an issue with my schema, but it is the one I get when I run `./apollo-ios-cli fetch-schema` . Has anyone else had the same problem? How can I resolve it?  
This is my structure in the Xcode project:

graphql\_schema\_Rick.graphql:

```auto
""""""
directive @cacheControl(
  """"""
  maxAge: Int

  """"""
  scope: CacheControlScope
) on FIELD_DEFINITION | OBJECT | INTERFACE

"""
A directive used by the Apollo iOS client to annotate operations or fragments that should be used exclusively for generating local cache mutations instead of as standard operations.
"""
directive @apollo_client_ios_localCacheMutation on QUERY | MUTATION | SUBSCRIPTION | FRAGMENT_DEFINITION

"""
A directive used by the Apollo iOS code generation engine to generate custom import statements in operation or fragment definition files. An import statement to import a module with the name provided in the `module` argument will be added to the generated definition file.
"""
directive @import(
  """The name of the module to import."""
  module: String!
) repeatable on QUERY | MUTATION | SUBSCRIPTION | FRAGMENT_DEFINITION

""""""
type Query {
  """Get a specific character by ID"""
  character(
    """"""
    id: ID!
  ): Character

  """Get the list of all characters"""
  characters(
    """"""
    page: Int

    """"""
    filter: FilterCharacter
  ): Characters

  """Get a list of characters selected by ids"""
  charactersByIds(
    """"""
    ids: [ID!]!
  ): [Character]

  """Get a specific locations by ID"""
  location(
    """"""
    id: ID!
  ): Location

  """Get the list of all locations"""
  locations(
    """"""
    page: Int

    """"""
    filter: FilterLocation
  ): Locations

  """Get a list of locations selected by ids"""
  locationsByIds(
    """"""
    ids: [ID!]!
  ): [Location]

  """Get a specific episode by ID"""
  episode(
    """"""
    id: ID!
  ): Episode

  """Get the list of all episodes"""
  episodes(
    """"""
    page: Int

    """"""
    filter: FilterEpisode
  ): Episodes

  """Get a list of episodes selected by ids"""
  episodesByIds(
    """"""
    ids: [ID!]!
  ): [Episode]
}

""""""
type Character {
  """The id of the character."""
  id: ID

  """The name of the character."""
  name: String

  """The status of the character ('Alive', 'Dead' or 'unknown')."""
  status: String

  """The species of the character."""
  species: String

  """The type or subspecies of the character."""
  type: String

  """
  The gender of the character ('Female', 'Male', 'Genderless' or 'unknown').
  """
  gender: String

  """The character's origin location"""
  origin: Location

  """The character's last known location"""
  location: Location

  """
  Link to the character's image.
  All images are 300x300px and most are medium shots or portraits since they are intended to be used as avatars.
  """
  image: String

  """Episodes in which this character appeared."""
  episode: [Episode]!

  """Time at which the character was created in the database."""
  created: String
}

""""""
type Location {
  """The id of the location."""
  id: ID

  """The name of the location."""
  name: String

  """The type of the location."""
  type: String

  """The dimension in which the location is located."""
  dimension: String

  """List of characters who have been last seen in the location."""
  residents: [Character]!

  """Time at which the location was created in the database."""
  created: String
}

""""""
type Episode {
  """The id of the episode."""
  id: ID

  """The name of the episode."""
  name: String

  """The air date of the episode."""
  air_date: String

  """The code of the episode."""
  episode: String

  """List of characters who have been seen in the episode."""
  characters: [Character]!

  """Time at which the episode was created in the database."""
  created: String
}

""""""
input FilterCharacter {
  """"""
  name: String

  """"""
  status: String

  """"""
  species: String

  """"""
  type: String

  """"""
  gender: String
}

""""""
type Characters {
  """"""
  info: Info

  """"""
  results: [Character]
}

""""""
type Info {
  """The length of the response."""
  count: Int

  """The amount of pages."""
  pages: Int

  """Number of the next page (if it exists)"""
  next: Int

  """Number of the previous page (if it exists)"""
  prev: Int
}

""""""
input FilterLocation {
  """"""
  name: String

  """"""
  type: String

  """"""
  dimension: String
}

""""""
type Locations {
  """"""
  info: Info

  """"""
  results: [Location]
}

""""""
input FilterEpisode {
  """"""
  name: String

  """"""
  episode: String
}

""""""
type Episodes {
  """"""
  info: Info

  """"""
  results: [Episode]
}

""""""
enum CacheControlScope {
  """"""
  PUBLIC

  """"""
  PRIVATE
}

"""The `Upload` scalar type represents a file upload."""
scalar Upload

```

characters.graphql:

```auto
query characters {
  characters {
    results {
      id
      image
    }
  }
}

```

apollo-codegen-config.json:

```auto
{
  "schemaNamespace": "GraphqlAPI",
  "input": {
    "operationSearchPaths": [
      "**/*.graphql",
      "**/*.graphqls",
    ],
    "schemaSearchPaths": ["graphql_schema_Rick.graphql"]
  },
  "output": {
    "testMocks": {
      "none": {}
    },
    "schemaTypes": {
      "path": ".././GraphqlAPI",
                                 
      "moduleType": {
        "swiftPackageManager": {}
      }
    },
    "operations": {
      "inSchemaModule": {}
    }
  },
  "schemaDownloadConfiguration": {
    "downloadMethod": {
      "introspection": {
        "endpointURL": "https://rickandmortyapi.com/graphql",
        "httpMethod": {
          "POST": {}
        },
        "includeDeprecatedInputValues": false,
        "outputFormat": "SDL"
      }
    },
    "downloadTimeout": 60,
    "headers": [],
    "outputPath": "./graphql_schema_Rick.graphql"
  }
}

```

 ![image](https://us1.discourse-cdn.com/flex019/uploads/apollographql/original/2X/b/be6c195ea29821c5eef13ec0ca9aa38eb232832e.jpeg)

---

<div class="post-metadata">

**Author:** ![calvincestari](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/calvincestari/32/339_2.png) [@calvincestari](https://community.apollographql.com/u/calvincestari)\
**Post date:** [May 27, 2024, 9:28pm UTC](https://community.apollographql.com/t/gettig-error-apollo-ios-cli-generate/7560/2 "2024-05-27T21:28:00Z")

</div>

Hi @Yeshua_A - your `operationSearchPaths` and `schemaSearchPaths` are conflicting with each other because `"**/*.graphql"` will find all `.graphql` files including your schema file. The codegen engine is trying to parse your schema file as an operation file and telling you it cannot execute the instructions because they are not operations.

Rename your schema file to use `.graphqls` extension and remove `"**/*.graphqls"` from `operationSearchPaths`. That should fix it for you.

---

<div class="post-metadata">

**Author:** ![Yeshua\_A](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/yeshua_a/32/5126_2.png) [@Yeshua\_A](https://community.apollographql.com/u/Yeshua_A)\
**Post date:** [May 27, 2024, 10:16pm UTC](https://community.apollographql.com/t/gettig-error-apollo-ios-cli-generate/7560/3 "2024-05-27T22:16:35Z")

</div>

Thank you so much! However, I’m still struggling 🫤. I’m getting another error:

```auto
Error: No GraphQL operations could be found. Please verify the operation search paths.

```

How should I set my `operationSearchPaths` with the following structure?

 ![image](https://us1.discourse-cdn.com/flex019/uploads/apollographql/original/2X/4/49e1f23c83e909afcc98c6cc41f356a741f1f08f.png)

characters.graphql:

```auto
query characters {
  characters {
    results {
      id
      image
    }
  }
}

```

Thank you in advance

---

<div class="post-metadata">

**Author:** ![calvincestari](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/calvincestari/32/339_2.png) [@calvincestari](https://community.apollographql.com/u/calvincestari)\
**Post date:** [May 27, 2024, 10:33pm UTC](https://community.apollographql.com/t/gettig-error-apollo-ios-cli-generate/7560/4 "2024-05-27T22:33:36Z")

</div>

Try move `apollo-ios-cli` and `apollo-codegen-config.json` to the root of the project then ` **/*.graphql` will run through all project subfolders. Right now it’s only looking in `Core/** ` and can’t find any operations.

Alternatively you could move the `Operations` folder into `Data` so it can be found from there too.

---

<div class="post-metadata">

**Author:** ![Yeshua\_A](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/yeshua_a/32/5126_2.png) [@Yeshua\_A](https://community.apollographql.com/u/Yeshua_A)\
**Post date:** [May 27, 2024, 11:39pm UTC](https://community.apollographql.com/t/gettig-error-apollo-ios-cli-generate/7560/5 "2024-05-27T23:39:46Z")

</div>

Thank you so much! That worked. I have attached an image of the project structure for anyone who might be struggling with this. Regards, Calvin 😊

 ![image](https://us1.discourse-cdn.com/flex019/uploads/apollographql/original/2X/0/0b77c51f4ff46b0ec30739d7619504e172110fd9.jpeg)

By the way, after that I just clean the project using ShiftCommandK & OptionShiftCommandK.
