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