1syntax = "proto3"; 2 3package tensorflow.error; 4 5option cc_enable_arenas = true; 6option java_outer_classname = "ErrorCodesProtos"; 7option java_multiple_files = true; 8option java_package = "org.tensorflow.framework"; 9option go_package = "github.com/tensorflow/tensorflow/tensorflow/go/core/protobuf/for_core_protos_go_proto"; 10 11// The canonical error codes for TensorFlow APIs. 12// 13// Warnings: 14// 15// - Do not change any numeric assignments. 16// - Changes to this list should only be made if there is a compelling 17// need that can't be satisfied in another way. Such changes 18// must be approved by at least two OWNERS. 19// - These error codes must match gRPC and protobuf error codes (except for 20// DO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_). 21// 22// Sometimes multiple error codes may apply. Services should return 23// the most specific error code that applies. For example, prefer 24// OUT_OF_RANGE over FAILED_PRECONDITION if both codes apply. 25// Similarly prefer NOT_FOUND or ALREADY_EXISTS over FAILED_PRECONDITION. 26enum Code { 27 // Not an error; returned on success 28 OK = 0; 29 30 // The operation was cancelled (typically by the caller). 31 CANCELLED = 1; 32 33 // Unknown error. An example of where this error may be returned is 34 // if a Status value received from another address space belongs to 35 // an error-space that is not known in this address space. Also 36 // errors raised by APIs that do not return enough error information 37 // may be converted to this error. 38 UNKNOWN = 2; 39 40 // Client specified an invalid argument. Note that this differs 41 // from FAILED_PRECONDITION. INVALID_ARGUMENT indicates arguments 42 // that are problematic regardless of the state of the system 43 // (e.g., a malformed file name). 44 INVALID_ARGUMENT = 3; 45 46 // Deadline expired before operation could complete. For operations 47 // that change the state of the system, this error may be returned 48 // even if the operation has completed successfully. For example, a 49 // successful response from a server could have been delayed long 50 // enough for the deadline to expire. 51 DEADLINE_EXCEEDED = 4; 52 53 // Some requested entity (e.g., file or directory) was not found. 54 // For privacy reasons, this code *may* be returned when the client 55 // does not have the access right to the entity. 56 NOT_FOUND = 5; 57 58 // Some entity that we attempted to create (e.g., file or directory) 59 // already exists. 60 ALREADY_EXISTS = 6; 61 62 // The caller does not have permission to execute the specified 63 // operation. PERMISSION_DENIED must not be used for rejections 64 // caused by exhausting some resource (use RESOURCE_EXHAUSTED 65 // instead for those errors). PERMISSION_DENIED must not be 66 // used if the caller can not be identified (use UNAUTHENTICATED 67 // instead for those errors). 68 PERMISSION_DENIED = 7; 69 70 // The request does not have valid authentication credentials for the 71 // operation. 72 UNAUTHENTICATED = 16; 73 74 // Some resource has been exhausted, perhaps a per-user quota, or 75 // perhaps the entire file system is out of space. 76 RESOURCE_EXHAUSTED = 8; 77 78 // Operation was rejected because the system is not in a state 79 // required for the operation's execution. For example, directory 80 // to be deleted may be non-empty, an rmdir operation is applied to 81 // a non-directory, etc. 82 // 83 // A litmus test that may help a service implementor in deciding 84 // between FAILED_PRECONDITION, ABORTED, and UNAVAILABLE: 85 // (a) Use UNAVAILABLE if the client can retry just the failing call. 86 // (b) Use ABORTED if the client should retry at a higher-level 87 // (e.g., restarting a read-modify-write sequence). 88 // (c) Use FAILED_PRECONDITION if the client should not retry until 89 // the system state has been explicitly fixed. E.g., if an "rmdir" 90 // fails because the directory is non-empty, FAILED_PRECONDITION 91 // should be returned since the client should not retry unless 92 // they have first fixed up the directory by deleting files from it. 93 // (d) Use FAILED_PRECONDITION if the client performs conditional 94 // REST Get/Update/Delete on a resource and the resource on the 95 // server does not match the condition. E.g., conflicting 96 // read-modify-write on the same resource. 97 FAILED_PRECONDITION = 9; 98 99 // The operation was aborted, typically due to a concurrency issue 100 // like sequencer check failures, transaction aborts, etc. 101 // 102 // See litmus test above for deciding between FAILED_PRECONDITION, 103 // ABORTED, and UNAVAILABLE. 104 ABORTED = 10; 105 106 // Operation tried to iterate past the valid input range. E.g., seeking or 107 // reading past end of file. 108 // 109 // Unlike INVALID_ARGUMENT, this error indicates a problem that may 110 // be fixed if the system state changes. For example, a 32-bit file 111 // system will generate INVALID_ARGUMENT if asked to read at an 112 // offset that is not in the range [0,2^32-1], but it will generate 113 // OUT_OF_RANGE if asked to read from an offset past the current 114 // file size. 115 // 116 // There is a fair bit of overlap between FAILED_PRECONDITION and 117 // OUT_OF_RANGE. We recommend using OUT_OF_RANGE (the more specific 118 // error) when it applies so that callers who are iterating through 119 // a space can easily look for an OUT_OF_RANGE error to detect when 120 // they are done. 121 OUT_OF_RANGE = 11; 122 123 // Operation is not implemented or not supported/enabled in this service. 124 UNIMPLEMENTED = 12; 125 126 // Internal errors. Means some invariant expected by the underlying 127 // system has been broken. If you see one of these errors, 128 // something is very broken. 129 INTERNAL = 13; 130 131 // The service is currently unavailable. This is a most likely a 132 // transient condition and may be corrected by retrying with 133 // a backoff. 134 // 135 // See litmus test above for deciding between FAILED_PRECONDITION, 136 // ABORTED, and UNAVAILABLE. 137 UNAVAILABLE = 14; 138 139 // Unrecoverable data loss or corruption. 140 DATA_LOSS = 15; 141 142 // An extra enum entry to prevent people from writing code that 143 // fails to compile when a new code is added. 144 // 145 // Nobody should ever reference this enumeration entry. In particular, 146 // if you write C++ code that switches on this enumeration, add a default: 147 // case instead of a case that mentions this enumeration entry. 148 // 149 // Nobody should rely on the value (currently 20) listed here. It 150 // may change in the future. 151 DO_NOT_USE_RESERVED_FOR_FUTURE_EXPANSION_USE_DEFAULT_IN_SWITCH_INSTEAD_ = 20; 152} 153