This page describes how to troubleshoot errors that you might encounter when you
deploy your Cloud Endpoints configuration. The error messages that you see
contain information specific to your project. For example, you might see an
error message that has your project ID in it. On this page you'll see
placeholder values such as <var translate="no">YOUR_PROJECT_ID</var>.

After each step, run the `gcloud endpoints services deploy` command again to see
if the error is resolved.

## Cannot convert to service config

`ERROR: (gcloud.endpoints.services.deploy) INVALID_ARGUMENT:`  

`Cannot convert to service config. http: undefined field <unknown>
on message <RequestType>`

Check your `.proto` file for mismatched fields between your
protocol buffer messages and [transcoding mappings](https://docs.cloud.google.com/endpoints/docs/grpc/transcoding.md.txt).

For example, the following in a `.proto` file produces this
error. The mapping option on `Unary` specifies a field named
`undefined` that isn't in the `Request` message
definition.

```
rpc Unary(Request) Response {
  option (google.api.http) { get : "/{undefined}" };
}

message Request {
  string defined = 1;
}
```

## Not allowed to get project settings

`ERROR: (gcloud.endpoints.services.deploy) PERMISSION_DENIED:`  

`Not allowed to get project settings for project YOUR_PROJECT_ID
`

1. Authenticate with gcloud CLI again to confirm that you authenticated with an account that has permission to access the project displayed in the error message:

   ```
   gcloud auth login
   ```

   A new browser tab opens and you are prompted to choose an account.
2. Confirm that the project ID displayed in the error message corresponds to the Google Cloud project that you intend to deploy the Endpoints configuration to:

   ```
   gcloud projects list
   ```
3. Confirm that gcloud CLI has the correct project ID set as the current project:

   ```
   gcloud config set project YOUR_PROJECT_ID
   ```

## Caller does not have permission

`ERROR: (gcloud.endpoints.services.deploy) PERMISSION_DENIED:`  

`Caller does not have permission 'servicemanagement.services.create' on
project YOUR_PROJECT_ID`

When you first deploy the Endpoints configuration,
Service Management creates a managed service for your API. To create a managed
service, at a minimum you must have the **Editor** role at the project level.
After Service Management creates the managed service, the minimum required
permissions to redeploy an Endpoints configuration is the
**Service Config Editor** role (**roles/servicemanagement.configEditor** )
on the service. For more information, see
[Granting access to the API](https://docs.cloud.google.com/endpoints/docs/grpc/control-api-access.md.txt).

## Ownership for domain name cannot be verified

`ERROR: (gcloud.endpoints.services.deploy) PERMISSION_DENIED:`  

`Ownership for domain name YOUR_DOMAIN_NAME on project
YOUR_PROJECT_ID cannot be verified`

- If you have a custom domain (for example, `example.com`) configured in the `name` field of your `api_config.yaml` file, you must [verify the
  domain name](https://docs.cloud.google.com/endpoints/docs/grpc/verify-domain-name) before you can deploy the service configuration.
- If you are using the `cloud.goog` domain, confirm that the value for the `name` field is in the following format, and that the project ID is correct:

  ```
  API_NAME.endpoints.YOUR_PROJECT_ID.cloud.goog
  ```

## Troubleshooting other errors

If you received an error not listed here, or if the information didn't
solve your problem, run the `gcloud` command again with the flag
to display debug information:

```
gcloud --verbosity=debug endpoints services deploy api_descriptor.pb api_config.yaml api_config_http.yaml
```

## What's next

- [`gcloud endpoints services deploy`](https://docs.cloud.google.com/sdk/gcloud/reference/endpoints/services/deploy)
- [Overview of API access](https://docs.cloud.google.com/endpoints/docs/grpc/api-access-overview.md.txt)