|
| 1 | +// Copyright 2026 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +syntax = "proto3"; |
| 16 | + |
| 17 | +package google.rpc; |
| 18 | + |
| 19 | +import "google/protobuf/duration.proto"; |
| 20 | + |
| 21 | +option go_package = "google.golang.org/genproto/googleapis/rpc/errdetails;errdetails"; |
| 22 | +option java_multiple_files = true; |
| 23 | +option java_outer_classname = "ErrorDetailsProto"; |
| 24 | +option java_package = "com.google.rpc"; |
| 25 | +option objc_class_prefix = "RPC"; |
| 26 | + |
| 27 | +// Describes the cause of the error with structured details. |
| 28 | +// |
| 29 | +// Example of an error when contacting the "pubsub.googleapis.com" API when it |
| 30 | +// is not enabled: |
| 31 | +// |
| 32 | +// { "reason": "API_DISABLED" |
| 33 | +// "domain": "googleapis.com" |
| 34 | +// "metadata": { |
| 35 | +// "resource": "projects/123", |
| 36 | +// "service": "pubsub.googleapis.com" |
| 37 | +// } |
| 38 | +// } |
| 39 | +// |
| 40 | +// This response indicates that the pubsub.googleapis.com API is not enabled. |
| 41 | +// |
| 42 | +// Example of an error that is returned when attempting to create a Spanner |
| 43 | +// instance in a region that is out of stock: |
| 44 | +// |
| 45 | +// { "reason": "STOCKOUT" |
| 46 | +// "domain": "spanner.googleapis.com", |
| 47 | +// "metadata": { |
| 48 | +// "availableRegions": "us-central1,us-east2" |
| 49 | +// } |
| 50 | +// } |
| 51 | +message ErrorInfo { |
| 52 | + // The reason of the error. This is a constant value that identifies the |
| 53 | + // proximate cause of the error. Error reasons are unique within a particular |
| 54 | + // domain of errors. This should be at most 63 characters and match a |
| 55 | + // regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, which represents |
| 56 | + // UPPER_SNAKE_CASE. |
| 57 | + string reason = 1; |
| 58 | + |
| 59 | + // The logical grouping to which the "reason" belongs. The error domain |
| 60 | + // is typically the registered service name of the tool or product that |
| 61 | + // generates the error. Example: "pubsub.googleapis.com". If the error is |
| 62 | + // generated by some common infrastructure, the error domain must be a |
| 63 | + // globally unique value that identifies the infrastructure. For Google API |
| 64 | + // infrastructure, the error domain is "googleapis.com". |
| 65 | + string domain = 2; |
| 66 | + |
| 67 | + // Additional structured details about this error. |
| 68 | + // |
| 69 | + // Keys must match a regular expression of `[a-z][a-zA-Z0-9-_]+` but should |
| 70 | + // ideally be lowerCamelCase. Also, they must be limited to 64 characters in |
| 71 | + // length. When identifying the current value of an exceeded limit, the units |
| 72 | + // should be contained in the key, not the value. For example, rather than |
| 73 | + // `{"instanceLimit": "100/request"}`, should be returned as, |
| 74 | + // `{"instanceLimitPerRequest": "100"}`, if the client exceeds the number of |
| 75 | + // instances that can be created in a single (batch) request. |
| 76 | + map<string, string> metadata = 3; |
| 77 | +} |
| 78 | + |
| 79 | +// Describes when the clients can retry a failed request. Clients could ignore |
| 80 | +// the recommendation here or retry when this information is missing from error |
| 81 | +// responses. |
| 82 | +// |
| 83 | +// It's always recommended that clients should use exponential backoff when |
| 84 | +// retrying. |
| 85 | +// |
| 86 | +// Clients should wait until `retry_delay` amount of time has passed since |
| 87 | +// receiving the error response before retrying. If retrying requests also |
| 88 | +// fail, clients should use an exponential backoff scheme to gradually increase |
| 89 | +// the delay between retries based on `retry_delay`, until either a maximum |
| 90 | +// number of retries have been reached or a maximum retry delay cap has been |
| 91 | +// reached. |
| 92 | +message RetryInfo { |
| 93 | + // Clients should wait at least this long between retrying the same request. |
| 94 | + google.protobuf.Duration retry_delay = 1; |
| 95 | +} |
| 96 | + |
| 97 | +// Describes additional debugging info. |
| 98 | +message DebugInfo { |
| 99 | + // The stack trace entries indicating where the error occurred. |
| 100 | + repeated string stack_entries = 1; |
| 101 | + |
| 102 | + // Additional debugging information provided by the server. |
| 103 | + string detail = 2; |
| 104 | +} |
| 105 | + |
| 106 | +// Describes how a quota check failed. |
| 107 | +// |
| 108 | +// For example if a daily limit was exceeded for the calling project, |
| 109 | +// a service could respond with a QuotaFailure detail containing the project |
| 110 | +// id and the description of the quota limit that was exceeded. If the |
| 111 | +// calling project hasn't enabled the service in the developer console, then |
| 112 | +// a service could respond with the project id and set `service_disabled` |
| 113 | +// to true. |
| 114 | +// |
| 115 | +// Also see RetryInfo and Help types for other details about handling a |
| 116 | +// quota failure. |
| 117 | +message QuotaFailure { |
| 118 | + // A message type used to describe a single quota violation. For example, a |
| 119 | + // daily quota or a custom quota that was exceeded. |
| 120 | + message Violation { |
| 121 | + // The subject on which the quota check failed. |
| 122 | + // For example, "clientip:<ip address of client>" or "project:<Google |
| 123 | + // developer project id>". |
| 124 | + string subject = 1; |
| 125 | + |
| 126 | + // A description of how the quota check failed. Clients can use this |
| 127 | + // description to find more about the quota configuration in the service's |
| 128 | + // public documentation, or find the relevant quota limit to adjust through |
| 129 | + // developer console. |
| 130 | + // |
| 131 | + // For example: "Service disabled" or "Daily Limit for read operations |
| 132 | + // exceeded". |
| 133 | + string description = 2; |
| 134 | + |
| 135 | + // The API Service from which the `QuotaFailure.Violation` orginates. In |
| 136 | + // some cases, Quota issues originate from an API Service other than the one |
| 137 | + // that was called. In other words, a dependency of the called API Service |
| 138 | + // could be the cause of the `QuotaFailure`, and this field would have the |
| 139 | + // dependency API service name. |
| 140 | + // |
| 141 | + // For example, if the called API is Kubernetes Engine API |
| 142 | + // (container.googleapis.com), and a quota violation occurs in the |
| 143 | + // Kubernetes Engine API itself, this field would be |
| 144 | + // "container.googleapis.com". On the other hand, if the quota violation |
| 145 | + // occurs when the Kubernetes Engine API creates VMs in the Compute Engine |
| 146 | + // API (compute.googleapis.com), this field would be |
| 147 | + // "compute.googleapis.com". |
| 148 | + string api_service = 3; |
| 149 | + |
| 150 | + // The metric of the violated quota. A quota metric is a named counter to |
| 151 | + // measure usage, such as API requests or CPUs. When an activity occurs in a |
| 152 | + // service, such as Virtual Machine allocation, one or more quota metrics |
| 153 | + // may be affected. |
| 154 | + // |
| 155 | + // For example, "compute.googleapis.com/cpus_per_vm_family", |
| 156 | + // "storage.googleapis.com/internet_egress_bandwidth". |
| 157 | + string quota_metric = 4; |
| 158 | + |
| 159 | + // The id of the violated quota. Also know as "limit name", this is the |
| 160 | + // unique identifier of a quota in the context of an API service. |
| 161 | + // |
| 162 | + // For example, "CPUS-PER-VM-FAMILY-per-project-region". |
| 163 | + string quota_id = 5; |
| 164 | + |
| 165 | + // The dimensions of the violated quota. Every non-global quota is enforced |
| 166 | + // on a set of dimensions. While quota metric defines what to count, the |
| 167 | + // dimensions specify for what aspects the counter should be increased. |
| 168 | + // |
| 169 | + // For example, the quota "CPUs per region per VM family" enforces a limit |
| 170 | + // on the metric "compute.googleapis.com/cpus_per_vm_family" on dimensions |
| 171 | + // "region" and "vm_family". And if the violation occurred in region |
| 172 | + // "us-central1" and for VM family "n1", the quota_dimensions would be, |
| 173 | + // |
| 174 | + // { |
| 175 | + // "region": "us-central1", |
| 176 | + // "vm_family": "n1", |
| 177 | + // } |
| 178 | + // |
| 179 | + // When a quota is enforced globally, the quota_dimensions would always be |
| 180 | + // empty. |
| 181 | + map<string, string> quota_dimensions = 6; |
| 182 | + |
| 183 | + // The enforced quota value at the time of the `QuotaFailure`. |
| 184 | + // |
| 185 | + // For example, if the enforced quota value at the time of the |
| 186 | + // `QuotaFailure` on the number of CPUs is "10", then the value of this |
| 187 | + // field would reflect this quantity. |
| 188 | + int64 quota_value = 7; |
| 189 | + |
| 190 | + // The new quota value being rolled out at the time of the violation. At the |
| 191 | + // completion of the rollout, this value will be enforced in place of |
| 192 | + // quota_value. If no rollout is in progress at the time of the violation, |
| 193 | + // this field is not set. |
| 194 | + // |
| 195 | + // For example, if at the time of the violation a rollout is in progress |
| 196 | + // changing the number of CPUs quota from 10 to 20, 20 would be the value of |
| 197 | + // this field. |
| 198 | + optional int64 future_quota_value = 8; |
| 199 | + } |
| 200 | + |
| 201 | + // Describes all quota violations. |
| 202 | + repeated Violation violations = 1; |
| 203 | +} |
| 204 | + |
| 205 | +// Describes what preconditions have failed. |
| 206 | +// |
| 207 | +// For example, if an RPC failed because it required the Terms of Service to be |
| 208 | +// acknowledged, it could list the terms of service violation in the |
| 209 | +// PreconditionFailure message. |
| 210 | +message PreconditionFailure { |
| 211 | + // A message type used to describe a single precondition failure. |
| 212 | + message Violation { |
| 213 | + // The type of PreconditionFailure. We recommend using a service-specific |
| 214 | + // enum type to define the supported precondition violation subjects. For |
| 215 | + // example, "TOS" for "Terms of Service violation". |
| 216 | + string type = 1; |
| 217 | + |
| 218 | + // The subject, relative to the type, that failed. |
| 219 | + // For example, "google.com/cloud" relative to the "TOS" type would indicate |
| 220 | + // which terms of service is being referenced. |
| 221 | + string subject = 2; |
| 222 | + |
| 223 | + // A description of how the precondition failed. Developers can use this |
| 224 | + // description to understand how to fix the failure. |
| 225 | + // |
| 226 | + // For example: "Terms of service not accepted". |
| 227 | + string description = 3; |
| 228 | + } |
| 229 | + |
| 230 | + // Describes all precondition violations. |
| 231 | + repeated Violation violations = 1; |
| 232 | +} |
| 233 | + |
| 234 | +// Describes violations in a client request. This error type focuses on the |
| 235 | +// syntactic aspects of the request. |
| 236 | +message BadRequest { |
| 237 | + // A message type used to describe a single bad request field. |
| 238 | + message FieldViolation { |
| 239 | + // A path that leads to a field in the request body. The value will be a |
| 240 | + // sequence of dot-separated identifiers that identify a protocol buffer |
| 241 | + // field. |
| 242 | + // |
| 243 | + // Consider the following: |
| 244 | + // |
| 245 | + // message CreateContactRequest { |
| 246 | + // message EmailAddress { |
| 247 | + // enum Type { |
| 248 | + // TYPE_UNSPECIFIED = 0; |
| 249 | + // HOME = 1; |
| 250 | + // WORK = 2; |
| 251 | + // } |
| 252 | + // |
| 253 | + // optional string email = 1; |
| 254 | + // repeated EmailType type = 2; |
| 255 | + // } |
| 256 | + // |
| 257 | + // string full_name = 1; |
| 258 | + // repeated EmailAddress email_addresses = 2; |
| 259 | + // } |
| 260 | + // |
| 261 | + // In this example, in proto `field` could take one of the following values: |
| 262 | + // |
| 263 | + // * `full_name` for a violation in the `full_name` value |
| 264 | + // * `email_addresses[0].email` for a violation in the `email` field of the |
| 265 | + // first `email_addresses` message |
| 266 | + // * `email_addresses[2].type[1]` for a violation in the second `type` |
| 267 | + // value in the third `email_addresses` message. |
| 268 | + // |
| 269 | + // In JSON, the same values are represented as: |
| 270 | + // |
| 271 | + // * `fullName` for a violation in the `fullName` value |
| 272 | + // * `emailAddresses[0].email` for a violation in the `email` field of the |
| 273 | + // first `emailAddresses` message |
| 274 | + // * `emailAddresses[2].type[1]` for a violation in the second `type` |
| 275 | + // value in the third `emailAddresses` message. |
| 276 | + string field = 1; |
| 277 | + |
| 278 | + // A description of why the request element is bad. |
| 279 | + string description = 2; |
| 280 | + |
| 281 | + // The reason of the field-level error. This is a constant value that |
| 282 | + // identifies the proximate cause of the field-level error. It should |
| 283 | + // uniquely identify the type of the FieldViolation within the scope of the |
| 284 | + // google.rpc.ErrorInfo.domain. This should be at most 63 |
| 285 | + // characters and match a regular expression of `[A-Z][A-Z0-9_]+[A-Z0-9]`, |
| 286 | + // which represents UPPER_SNAKE_CASE. |
| 287 | + string reason = 3; |
| 288 | + |
| 289 | + // Provides a localized error message for field-level errors that is safe to |
| 290 | + // return to the API consumer. |
| 291 | + LocalizedMessage localized_message = 4; |
| 292 | + } |
| 293 | + |
| 294 | + // Describes all violations in a client request. |
| 295 | + repeated FieldViolation field_violations = 1; |
| 296 | +} |
| 297 | + |
| 298 | +// Contains metadata about the request that clients can attach when filing a bug |
| 299 | +// or providing other forms of feedback. |
| 300 | +message RequestInfo { |
| 301 | + // An opaque string that should only be interpreted by the service generating |
| 302 | + // it. For example, it can be used to identify requests in the service's logs. |
| 303 | + string request_id = 1; |
| 304 | + |
| 305 | + // Any data that was used to serve this request. For example, an encrypted |
| 306 | + // stack trace that can be sent back to the service provider for debugging. |
| 307 | + string serving_data = 2; |
| 308 | +} |
| 309 | + |
| 310 | +// Describes the resource that is being accessed. |
| 311 | +message ResourceInfo { |
| 312 | + // A name for the type of resource being accessed, e.g. "sql table", |
| 313 | + // "cloud storage bucket", "file", "Google calendar"; or the type URL |
| 314 | + // of the resource: e.g. "type.googleapis.com/google.pubsub.v1.Topic". |
| 315 | + string resource_type = 1; |
| 316 | + |
| 317 | + // The name of the resource being accessed. For example, a shared calendar |
| 318 | + // name: "example.com_4fghdhgsrgh@group.calendar.google.com", if the current |
| 319 | + // error is |
| 320 | + // [google.rpc.Code.PERMISSION_DENIED][google.rpc.Code.PERMISSION_DENIED]. |
| 321 | + string resource_name = 2; |
| 322 | + |
| 323 | + // The owner of the resource (optional). |
| 324 | + // For example, "user:<owner email>" or "project:<Google developer project |
| 325 | + // id>". |
| 326 | + string owner = 3; |
| 327 | + |
| 328 | + // Describes what error is encountered when accessing this resource. |
| 329 | + // For example, updating a cloud project may require the `writer` permission |
| 330 | + // on the developer console project. |
| 331 | + string description = 4; |
| 332 | +} |
| 333 | + |
| 334 | +// Provides links to documentation or for performing an out of band action. |
| 335 | +// |
| 336 | +// For example, if a quota check failed with an error indicating the calling |
| 337 | +// project hasn't enabled the accessed service, this can contain a URL pointing |
| 338 | +// directly to the right place in the developer console to flip the bit. |
| 339 | +message Help { |
| 340 | + // Describes a URL link. |
| 341 | + message Link { |
| 342 | + // Describes what the link offers. |
| 343 | + string description = 1; |
| 344 | + |
| 345 | + // The URL of the link. |
| 346 | + string url = 2; |
| 347 | + } |
| 348 | + |
| 349 | + // URL(s) pointing to additional information on handling the current error. |
| 350 | + repeated Link links = 1; |
| 351 | +} |
| 352 | + |
| 353 | +// Provides a localized error message that is safe to return to the user |
| 354 | +// which can be attached to an RPC error. |
| 355 | +message LocalizedMessage { |
| 356 | + // The locale used following the specification defined at |
| 357 | + // https://www.rfc-editor.org/rfc/bcp/bcp47.txt. |
| 358 | + // Examples are: "en-US", "fr-CH", "es-MX" |
| 359 | + string locale = 1; |
| 360 | + |
| 361 | + // The localized error message in the above locale. |
| 362 | + string message = 2; |
| 363 | +} |
0 commit comments