errors.go RawHistoryFolder
1package domain
2
3import "errors"
4
5// Domain errors represent business-level errors that can occur in the system.
6// These errors are used across layers to communicate specific failure conditions.
7var (
8 // Container errors
9 ErrContainerNotFound = errors.New("container not found")
10 ErrContainerExists = errors.New("container already exists")
11 ErrContainerNotRunning = errors.New("container is not running")
12 ErrContainerRunning = errors.New("container is already running")
13 ErrContainerExited = errors.New("container exited")
14 // ErrRuntimeUnsupported wraps device-bearing create failures on
15 // engines that cannot serve CDI device requests. It fails closed:
16 // Gordon never retries without devices.
17 ErrRuntimeUnsupported = errors.New("runtime does not support CDI device requests")
18
19 // Image errors
20 ErrImageNotFound = errors.New("image not found")
21 ErrImagePullFailed = errors.New("failed to pull image")
22 ErrInvalidImageFormat = errors.New("invalid image format")
23
24 // Route errors
25 ErrRouteNotFound = errors.New("route not found")
26 ErrRouteExists = errors.New("route already exists")
27 ErrInvalidRoute = errors.New("invalid route configuration")
28 ErrNoRouteForImage = errors.New("no route configured for image")
29 ErrRouteDomainEmpty = errors.New("route domain cannot be empty")
30 ErrRouteImageEmpty = errors.New("route image cannot be empty")
31 ErrRouteDomainInvalid = errors.New("route domain is not a valid public hostname")
32 ErrNoTargetAvailable = errors.New("no target available for route")
33
34 // Registry errors
35 ErrManifestNotFound = errors.New("manifest not found")
36 ErrBlobNotFound = errors.New("blob not found")
37 ErrUploadNotFound = errors.New("upload not found")
38 ErrInvalidDigest = errors.New("invalid digest")
39 ErrDigestMismatch = errors.New("digest mismatch")
40 ErrUnauthorized = errors.New("unauthorized")
41 ErrBlobSizeExceeded = errors.New("blob size exceeds maximum")
42 ErrExecOutputExceeded = errors.New("container exec output exceeds maximum")
43 // ErrManifestBlobUnknown marks a manifest that references config or
44 // layer content the repository never completed an upload for.
45 ErrManifestBlobUnknown = errors.New("manifest references a blob the repository does not own")
46
47 // Network errors
48 ErrNetworkNotFound = errors.New("network not found")
49 ErrNetworkExists = errors.New("network already exists")
50
51 // Volume errors
52 ErrVolumeNotFound = errors.New("volume not found")
53 ErrVolumeExists = errors.New("volume already exists")
54 ErrVolumeBackupUnavailable = errors.New("volume backup service unavailable")
55 ErrVolumeOwnershipUnverified = errors.New("volume ownership cannot be verified")
56
57 // Preview errors
58 ErrPreviewNotFound = errors.New("preview not found")
59
60 // Config errors
61 ErrTrafficGraphRequired = errors.New("traffic graph is required")
62 ErrClientHelloTooLarge = errors.New("client hello exceeds maximum")
63 ErrConfigNotFound = errors.New("configuration not found")
64 ErrInvalidConfig = errors.New("invalid configuration")
65 ErrConfigLoadFailed = errors.New("failed to load configuration")
66 ErrInvalidDomainPattern = errors.New("invalid domain pattern")
67 ErrRouteConflict = errors.New("route conflicts with existing configuration")
68
69 // App manifest errors
70 ErrInvalidAppSpec = errors.New("invalid app manifest")
71 // ErrInvalidNetworkProbe wraps malformed bounded container-network
72 // readiness requests. It is distinct from ErrInvalidAppSpec: the
73 // manifest may be valid while one probe request is not.
74 ErrInvalidNetworkProbe = errors.New("invalid network probe request")
75 // ErrNetworkProbeCleanup marks a helper that could not be force-removed.
76 // Callers must fail immediately rather than create another helper.
77 ErrNetworkProbeCleanup = errors.New("network probe helper cleanup failed")
78 // ErrBindPolicy wraps administrative bind policy violations. It is
79 // distinct from ErrInvalidAppSpec: the manifest may be valid while the
80 // installation policy refuses to serve it.
81 ErrBindPolicy = errors.New("bind policy violation")
82 // ErrDevicePolicy wraps administrative device policy violations. It is
83 // distinct from ErrInvalidAppSpec: the manifest may be valid while the
84 // installation policy refuses to serve it.
85 ErrDevicePolicy = errors.New("device policy violation")
86 // ErrCapabilityPolicy wraps administrative Linux capability policy
87 // violations. It is distinct from ErrInvalidAppSpec: the manifest may
88 // be valid while the installation policy refuses to serve it.
89 ErrCapabilityPolicy = errors.New("capability policy violation")
90 // ErrRuntimeGuard wraps app container configs refused by the runtime
91 // guard: host or shared namespaces, host paths passed as volume
92 // names, or binds overlapping Gordon's own sensitive paths.
93 ErrRuntimeGuard = errors.New("runtime guard violation")
94
95 // App state errors
96 ErrAppStateIO = errors.New("app state storage failure")
97 ErrAppStateCorrupt = errors.New("app state is corrupt")
98 ErrAppStateIncompatible = errors.New("app state format is not supported by this binary")
99 ErrAppStateConflict = errors.New("app state conflict")
100 // ErrAppNotFound marks a lifecycle mutation of a name that has no
101 // live app identity at all. It is distinct from a missing revision
102 // or operation on a known app.
103 ErrAppNotFound = errors.New("app not found")
104 ErrAppRevisionNotFound = errors.New("app revision not found")
105 ErrAppIntentNotFound = errors.New("app apply intent not found")
106 ErrAppOperationNotFound = errors.New("app operation not found")
107 ErrAppReservationConflict = errors.New("listener reservation conflict")
108 ErrAppTrafficProjection = errors.New("app traffic projection failed")
109 ErrAppImageUnresolvable = errors.New("image reference unresolvable")
110 ErrAppImageNotAllowed = errors.New("image reference not allowed by installation policy")
111 ErrAppSecretMissing = errors.New("required app secret missing")
112 ErrAppUnmanagedImageVolume = errors.New("image declares unmanaged volume")
113 // ErrAppServiceScope marks an app-wide mutation of a multi-service app
114 // that named neither one service nor all of them.
115 ErrAppServiceScope = errors.New("app service scope required")
116 // ErrPruneDisabled means prune could not establish a safe scope for
117 // the requested operation at all (for example, its protection or
118 // runtime ports are not wired). It is never returned merely because
119 // app state exists: protected and unknown candidates are reported
120 // per candidate and do not fail the operation.
121 ErrPruneDisabled = errors.New("pruning unavailable: cannot establish a safe prune scope")
122
123 // Environment errors
124 ErrEnvFileNotFound = errors.New("environment file not found")
125 ErrSecretNotFound = errors.New("secret not found")
126 ErrSecretsAlreadyExist = errors.New("secrets already exist")
127 ErrProviderNotFound = errors.New("secret provider not found")
128 ErrAttachmentOwnershipMismatch = errors.New("attachment ownership mismatch")
129 ErrReadinessLogSizeExceeded = errors.New("readiness log exceeds maximum")
130
131 // Authentication errors
132 ErrInvalidToken = errors.New("invalid token")
133 ErrExpiredToken = errors.New("token has expired")
134 ErrRevokedToken = errors.New("token has been revoked")
135 ErrInvalidCredentials = errors.New("invalid credentials")
136 ErrTokenNotFound = errors.New("token not found")
137
138 // Security errors
139 ErrPathTraversal = errors.New("path traversal not allowed")
140 ErrInvalidPath = errors.New("invalid path format")
141 ErrInsufficientScope = errors.New("insufficient scope for operation")
142 ErrInvalidScope = errors.New("invalid scope format")
143 ErrSSRFBlocked = errors.New("request to internal/blocked network not allowed")
144 ErrInvalidEnvKey = errors.New("invalid environment variable key")
145 ErrEnvContainsSecretRef = errors.New("environment file contains secret reference")
146 ErrLongLivedToken = errors.New("long-lived tokens must be exchanged via /auth/token")
147
148 // Remote errors
149 ErrEmptyRemoteName = errors.New("remote name must not be empty")
150 ErrInvalidRemoteNameChar = errors.New("remote name contains invalid characters")
151 ErrConsecutiveDots = errors.New("remote name must not contain consecutive dots")
152 ErrPassUnavailable = errors.New("pass is not available")
153 ErrRemoteNotFound = errors.New("remote not found")
154
155 // Attachment errors
156 ErrAttachmentNotFound = errors.New("attachment not found")
157 ErrAttachmentExists = errors.New("attachment already exists")
158 ErrAttachmentImageEmpty = errors.New("attachment image cannot be empty")
159 ErrAttachmentTargetEmpty = errors.New("attachment target (domain or group) cannot be empty")
160 ErrAttachmentNotDeployed = errors.New("configured attachment is not deployed; run gordon deploy to create it")
161
162 // TLS / ACME errors
163 ErrACMEDisabled = errors.New("acme disabled")
164 ErrACMEEmailRequired = errors.New("acme email required")
165 ErrACMEChallengeInvalid = errors.New("acme challenge invalid")
166 ErrDNSConfigInvalid = errors.New("dns configuration invalid")
167 ErrCloudflareTokenMissing = errors.New("cloudflare api token missing")
168 ErrCertificateStoreRequired = errors.New("certificate store required")
169 ErrCertificateIssuerRequired = errors.New("certificate issuer required")
170 ErrRouteSourceRequired = errors.New("route source required")
171 ErrHTTPChallengeSinkRequired = errors.New("http challenge sink required")
172 ErrTLSRouteNotCovered = errors.New("tls route not covered by public certificate")
173
174 // Traffic errors
175 ErrTrafficStatusUnavailable = errors.New("traffic status unavailable")
176)