github.com/containers/podman/v4@v4.9.4/libpod/define/errors.go (about) 1 package define 2 3 import ( 4 "errors" 5 "fmt" 6 7 "github.com/containers/common/libnetwork/types" 8 "github.com/containers/common/pkg/detach" 9 ) 10 11 var ( 12 // ErrNoSuchCtr indicates the requested container does not exist 13 ErrNoSuchCtr = errors.New("no such container") 14 15 // ErrNoSuchPod indicates the requested pod does not exist 16 ErrNoSuchPod = errors.New("no such pod") 17 18 // ErrNoSuchVolume indicates the requested volume does not exist 19 ErrNoSuchVolume = errors.New("no such volume") 20 21 // ErrNoSuchNetwork indicates the requested network does not exist 22 ErrNoSuchNetwork = types.ErrNoSuchNetwork 23 24 // ErrNoSuchExecSession indicates that the requested exec session does 25 // not exist. 26 ErrNoSuchExecSession = errors.New("no such exec session") 27 28 // ErrNoSuchExitCode indicates that the requested container exit code 29 // does not exist. 30 ErrNoSuchExitCode = errors.New("no such exit code") 31 32 // ErrDepExists indicates that the current object has dependencies and 33 // cannot be removed before them. 34 ErrDepExists = errors.New("dependency exists") 35 36 // ErrNoAliases indicates that the container does not have any network 37 // aliases. 38 ErrNoAliases = errors.New("no aliases for container") 39 40 // ErrMissingPlugin indicates that the requested operation requires a 41 // plugin that is not present on the system or in the configuration. 42 ErrMissingPlugin = errors.New("required plugin missing") 43 44 // ErrCtrExists indicates a container with the same name or ID already 45 // exists 46 ErrCtrExists = errors.New("container already exists") 47 // ErrPodExists indicates a pod with the same name or ID already exists 48 ErrPodExists = errors.New("pod already exists") 49 // ErrImageExists indicates an image with the same ID already exists 50 ErrImageExists = errors.New("image already exists") 51 // ErrVolumeExists indicates a volume with the same name already exists 52 ErrVolumeExists = errors.New("volume already exists") 53 // ErrExecSessionExists indicates an exec session with the same ID 54 // already exists. 55 ErrExecSessionExists = errors.New("exec session already exists") 56 // ErrNetworkExists indicates that a network with the given name already 57 // exists. 58 ErrNetworkExists = types.ErrNetworkExists 59 60 // ErrCtrStateInvalid indicates a container is in an improper state for 61 // the requested operation 62 ErrCtrStateInvalid = errors.New("container state improper") 63 // ErrExecSessionStateInvalid indicates that an exec session is in an 64 // improper state for the requested operation 65 ErrExecSessionStateInvalid = errors.New("exec session state improper") 66 // ErrVolumeBeingUsed indicates that a volume is being used by at least one container 67 ErrVolumeBeingUsed = errors.New("volume is being used") 68 69 // ErrRuntimeFinalized indicates that the runtime has already been 70 // created and cannot be modified 71 ErrRuntimeFinalized = errors.New("runtime has been finalized") 72 // ErrCtrFinalized indicates that the container has already been created 73 // and cannot be modified 74 ErrCtrFinalized = errors.New("container has been finalized") 75 // ErrPodFinalized indicates that the pod has already been created and 76 // cannot be modified 77 ErrPodFinalized = errors.New("pod has been finalized") 78 // ErrVolumeFinalized indicates that the volume has already been created and 79 // cannot be modified 80 ErrVolumeFinalized = errors.New("volume has been finalized") 81 82 // ErrInvalidArg indicates that an invalid argument was passed 83 ErrInvalidArg = types.ErrInvalidArg 84 // ErrEmptyID indicates that an empty ID was passed 85 ErrEmptyID = errors.New("name or ID cannot be empty") 86 87 // ErrInternal indicates an internal library error 88 ErrInternal = errors.New("internal libpod error") 89 90 // ErrPodPartialFail indicates that a pod operation was only partially 91 // successful, and some containers within the pod failed. 92 ErrPodPartialFail = errors.New("some containers failed") 93 94 // ErrDetach indicates that an attach session was manually detached by 95 // the user. 96 ErrDetach = detach.ErrDetach 97 98 // ErrWillDeadlock indicates that the requested operation will cause a 99 // deadlock. This is usually caused by upgrade issues, and is resolved 100 // by renumbering the locks. 101 ErrWillDeadlock = errors.New("deadlock due to lock mismatch") 102 103 // ErrNoCgroups indicates that the container does not have its own 104 // Cgroup. 105 ErrNoCgroups = errors.New("this container does not have a cgroup") 106 // ErrNoLogs indicates that this container is not creating a log so log 107 // operations cannot be performed on it 108 ErrNoLogs = errors.New("this container is not logging output") 109 110 // ErrRootless indicates that the given command cannot but run without 111 // root. 112 ErrRootless = errors.New("operation requires root privileges") 113 114 // ErrRuntimeStopped indicates that the runtime has already been shut 115 // down and no further operations can be performed on it 116 ErrRuntimeStopped = errors.New("runtime has already been stopped") 117 // ErrCtrStopped indicates that the requested container is not running 118 // and the requested operation cannot be performed until it is started 119 ErrCtrStopped = errors.New("container is stopped") 120 121 // ErrCtrRemoved indicates that the container has already been removed 122 // and no further operations can be performed on it 123 ErrCtrRemoved = errors.New("container has already been removed") 124 // ErrPodRemoved indicates that the pod has already been removed and no 125 // further operations can be performed on it 126 ErrPodRemoved = errors.New("pod has already been removed") 127 // ErrVolumeRemoved indicates that the volume has already been removed and 128 // no further operations can be performed on it 129 ErrVolumeRemoved = errors.New("volume has already been removed") 130 // ErrExecSessionRemoved indicates that the exec session has already 131 // been removed and no further operations can be performed on it. 132 ErrExecSessionRemoved = errors.New("exec session has already been removed") 133 134 // ErrDBClosed indicates that the connection to the state database has 135 // already been closed 136 ErrDBClosed = errors.New("database connection already closed") 137 // ErrDBBadConfig indicates that the database has a different schema or 138 // was created by a libpod with a different config 139 ErrDBBadConfig = errors.New("database configuration mismatch") 140 141 // ErrNSMismatch indicates that the requested pod or container is in a 142 // different namespace and cannot be accessed or modified. 143 ErrNSMismatch = errors.New("target is in a different namespace") 144 145 // ErrNotImplemented indicates that the requested functionality is not 146 // yet present 147 ErrNotImplemented = errors.New("not yet implemented") 148 149 // ErrOSNotSupported indicates the function is not available on the particular 150 // OS. 151 ErrOSNotSupported = errors.New("no support for this OS yet") 152 153 // ErrOCIRuntime indicates a generic error from the OCI runtime 154 ErrOCIRuntime = errors.New("OCI runtime error") 155 156 // ErrOCIRuntimePermissionDenied indicates the OCI runtime attempted to invoke a command that returned 157 // a permission denied error 158 ErrOCIRuntimePermissionDenied = errors.New("OCI permission denied") 159 160 // ErrOCIRuntimeNotFound indicates the OCI runtime attempted to invoke a command 161 // that was not found 162 ErrOCIRuntimeNotFound = errors.New("OCI runtime attempted to invoke a command that was not found") 163 164 // ErrOCIRuntimeUnavailable indicates that the OCI runtime associated to a container 165 // could not be found in the configuration 166 ErrOCIRuntimeUnavailable = errors.New("OCI unavailable") 167 168 // ErrConmonOutdated indicates the version of conmon found (whether via the configuration or $PATH) 169 // is out of date for the current podman version 170 ErrConmonOutdated = errors.New("outdated conmon version") 171 // ErrConmonDead indicates that the container's conmon process has been 172 // killed, preventing normal operation. 173 ErrConmonDead = errors.New("conmon process killed") 174 175 // ErrNetworkOnPodContainer indicates the user wishes to alter network attributes on a container 176 // in a pod. This cannot be done as the infra container has all the network information 177 ErrNetworkOnPodContainer = errors.New("network cannot be configured when it is shared with a pod") 178 179 // ErrNetworkInUse indicates the requested operation failed because the network was in use 180 ErrNetworkInUse = errors.New("network is being used") 181 182 // ErrNetworkConnected indicates that the required operation failed because the container is already a network endpoint 183 ErrNetworkConnected = errors.New("network is already connected") 184 185 // ErrStoreNotInitialized indicates that the container storage was never 186 // initialized. 187 ErrStoreNotInitialized = errors.New("the container storage was never initialized") 188 189 // ErrNoNetwork indicates that a container has no net namespace, like network=none 190 ErrNoNetwork = errors.New("container has no network namespace") 191 192 // ErrNetworkModeInvalid indicates that a container has the wrong network mode for an operation 193 ErrNetworkModeInvalid = errors.New("invalid network mode") 194 195 // ErrSetSecurityAttribute indicates that a request to set a container's security attribute 196 // was not possible. 197 ErrSetSecurityAttribute = fmt.Errorf("%w: unable to assign security attribute", ErrOCIRuntime) 198 199 // ErrGetSecurityAttribute indicates that a request to get a container's security attribute 200 // was not possible. 201 ErrGetSecurityAttribute = fmt.Errorf("%w: unable to get security attribute", ErrOCIRuntime) 202 203 // ErrSecurityAttribute indicates that an error processing security attributes 204 // for the container 205 ErrSecurityAttribute = fmt.Errorf("%w: unable to process security attribute", ErrOCIRuntime) 206 207 // ErrCanceled indicates that an operation has been cancelled by a user. 208 // Useful for potentially long running tasks. 209 ErrCanceled = errors.New("cancelled by user") 210 211 // ErrConmonVersionFormat is used when the expected version format of conmon 212 // has changed. 213 ErrConmonVersionFormat = "conmon version changed format" 214 215 // ErrRemovingCtrs indicates that there was an error removing all 216 // containers from a pod. 217 ErrRemovingCtrs = errors.New("removing pod containers") 218 )