2023-02-21 20:43:01 -05:00
// Copyright (c) 2015-2023 MinIO, Inc.
2021-04-18 15:41:13 -04:00
//
// This file is part of MinIO Object Storage stack
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
2015-02-15 03:48:15 -05:00
2016-08-18 19:23:42 -04:00
package cmd
2015-02-11 06:23:15 -05:00
import (
2018-02-02 21:18:52 -05:00
"context"
2015-02-11 06:23:15 -05:00
"encoding/xml"
2021-09-09 17:37:07 -04:00
"errors"
2018-01-11 02:06:36 -05:00
"fmt"
2015-02-11 06:23:15 -05:00
"net/http"
2020-02-11 22:38:02 -05:00
"net/url"
2024-02-09 16:25:16 -05:00
"os"
2021-09-09 17:37:07 -04:00
"strconv"
2019-03-07 19:11:28 -05:00
"strings"
2017-10-22 01:30:34 -04:00
2024-08-13 14:21:34 -04:00
"github.com/Azure/azure-sdk-for-go/sdk/azcore"
2023-05-05 22:53:12 -04:00
"github.com/minio/minio/internal/ioutil"
2019-02-12 04:25:52 -05:00
"google.golang.org/api/googleapi"
2023-06-19 20:53:08 -04:00
"github.com/minio/madmin-go/v3"
2022-08-29 19:57:16 -04:00
"github.com/minio/minio-go/v7"
2020-07-14 12:38:05 -04:00
"github.com/minio/minio-go/v7/pkg/tags"
2021-06-01 17:59:40 -04:00
"github.com/minio/minio/internal/auth"
"github.com/minio/minio/internal/bucket/lifecycle"
"github.com/minio/minio/internal/bucket/replication"
"github.com/minio/minio/internal/config/dns"
"github.com/minio/minio/internal/crypto"
2023-03-16 14:59:42 -04:00
"github.com/minio/minio/internal/kms"
2021-06-01 17:59:40 -04:00
"github.com/minio/minio/internal/logger"
2020-07-21 20:49:56 -04:00
2021-06-01 17:59:40 -04:00
objectlock "github.com/minio/minio/internal/bucket/object/lock"
"github.com/minio/minio/internal/bucket/versioning"
2023-03-07 11:12:41 -05:00
levent "github.com/minio/minio/internal/config/lambda/event"
2021-06-01 17:59:40 -04:00
"github.com/minio/minio/internal/event"
"github.com/minio/minio/internal/hash"
2024-05-24 19:05:23 -04:00
"github.com/minio/pkg/v3/policy"
2015-02-11 06:23:15 -05:00
)
2015-09-19 03:52:01 -04:00
// APIError structure
type APIError struct {
2015-02-11 06:23:15 -05:00
Code string
Description string
2015-03-06 00:07:19 -05:00
HTTPStatusCode int
2024-05-05 12:56:21 -04:00
ObjectSize string
RangeRequested string
2015-02-11 06:23:15 -05:00
}
2015-09-19 03:52:01 -04:00
// APIErrorResponse - error response format
type APIErrorResponse struct {
2024-05-05 12:56:21 -04:00
XMLName xml . Name ` xml:"Error" json:"-" `
Code string
Message string
Key string ` xml:"Key,omitempty" json:"Key,omitempty" `
BucketName string ` xml:"BucketName,omitempty" json:"BucketName,omitempty" `
Resource string
Region string ` xml:"Region,omitempty" json:"Region,omitempty" `
RequestID string ` xml:"RequestId" json:"RequestId" `
HostID string ` xml:"HostId" json:"HostId" `
ActualObjectSize string ` xml:"ActualObjectSize,omitempty" json:"ActualObjectSize,omitempty" `
RangeRequested string ` xml:"RangeRequested,omitempty" json:"RangeRequested,omitempty" `
2015-02-11 06:23:15 -05:00
}
2016-03-10 05:24:52 -05:00
// APIErrorCode type of error status.
type APIErrorCode int
2021-03-31 12:30:52 -04:00
//go:generate stringer -type=APIErrorCode -trimprefix=Err $GOFILE
2015-04-22 19:28:13 -04:00
// Error codes, non exhaustive list - http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html
2015-02-11 06:23:15 -05:00
const (
2016-03-10 05:24:52 -05:00
ErrNone APIErrorCode = iota
ErrAccessDenied
ErrBadDigest
ErrEntityTooSmall
ErrEntityTooLarge
2019-04-22 04:23:54 -04:00
ErrPolicyTooLarge
2016-03-10 05:24:52 -05:00
ErrIncompleteBody
ErrInternalError
ErrInvalidAccessKeyID
2021-12-22 14:40:21 -05:00
ErrAccessKeyDisabled
2023-06-12 16:22:07 -04:00
ErrInvalidArgument
2016-03-10 05:24:52 -05:00
ErrInvalidBucketName
ErrInvalidDigest
ErrInvalidRange
2021-04-07 17:37:10 -04:00
ErrInvalidRangePartNumber
2017-03-03 19:32:04 -05:00
ErrInvalidCopyPartRange
ErrInvalidCopyPartRangeSource
2016-03-10 05:24:52 -05:00
ErrInvalidMaxKeys
2019-02-24 01:14:24 -05:00
ErrInvalidEncodingMethod
2016-03-10 05:24:52 -05:00
ErrInvalidMaxUploads
ErrInvalidMaxParts
ErrInvalidPartNumberMarker
2021-01-22 15:09:24 -05:00
ErrInvalidPartNumber
2016-03-10 05:24:52 -05:00
ErrInvalidRequestBody
ErrInvalidCopySource
2016-12-26 19:29:26 -05:00
ErrInvalidMetadataDirective
2016-03-10 05:24:52 -05:00
ErrInvalidCopyDest
ErrInvalidPolicyDocument
2016-10-20 19:09:55 -04:00
ErrInvalidObjectState
2016-03-10 05:24:52 -05:00
ErrMalformedXML
ErrMissingContentLength
ErrMissingContentMD5
ErrMissingRequestBodyError
2020-02-16 01:07:52 -05:00
ErrMissingSecurityHeader
2016-03-10 05:24:52 -05:00
ErrNoSuchBucket
ErrNoSuchBucketPolicy
2019-07-19 16:20:33 -04:00
ErrNoSuchBucketLifecycle
2020-02-08 06:16:59 -05:00
ErrNoSuchLifecycleConfiguration
2021-11-19 20:54:10 -05:00
ErrInvalidLifecycleWithObjectLock
2020-02-05 04:42:34 -05:00
ErrNoSuchBucketSSEConfig
2020-05-19 16:53:54 -04:00
ErrNoSuchCORSConfiguration
ErrNoSuchWebsiteConfiguration
ErrReplicationConfigurationNotFoundError
2020-10-08 13:54:11 -04:00
ErrRemoteDestinationNotFoundError
2020-08-05 02:02:27 -04:00
ErrReplicationDestinationMissingLock
2020-10-08 13:54:11 -04:00
ErrRemoteTargetNotFoundError
2020-09-04 11:48:38 -04:00
ErrReplicationRemoteConnectionError
2021-06-24 21:29:30 -04:00
ErrReplicationBandwidthLimitError
2020-07-30 22:55:22 -04:00
ErrBucketRemoteIdenticalToSource
ErrBucketRemoteAlreadyExists
2020-10-08 13:54:11 -04:00
ErrBucketRemoteLabelInUse
2020-07-30 22:55:22 -04:00
ErrBucketRemoteArnTypeInvalid
ErrBucketRemoteArnInvalid
ErrBucketRemoteRemoveDisallowed
2020-10-08 13:54:11 -04:00
ErrRemoteTargetNotVersionedError
2020-08-06 20:10:21 -04:00
ErrReplicationSourceNotVersionedError
2020-07-21 20:49:56 -04:00
ErrReplicationNeedsVersioningError
ErrReplicationBucketNeedsVersioningError
2021-12-15 13:37:08 -05:00
ErrReplicationDenyEditError
2023-05-11 18:48:40 -04:00
ErrRemoteTargetDenyAddError
2022-06-06 05:54:39 -04:00
ErrReplicationNoExistingObjects
2023-07-10 23:09:20 -04:00
ErrReplicationValidationError
ErrReplicationPermissionCheckError
2020-11-12 15:12:09 -05:00
ErrObjectRestoreAlreadyInProgress
2016-03-10 05:24:52 -05:00
ErrNoSuchKey
ErrNoSuchUpload
2020-11-29 00:15:45 -05:00
ErrInvalidVersionID
2018-12-12 14:43:44 -05:00
ErrNoSuchVersion
2016-03-10 05:24:52 -05:00
ErrNotImplemented
2016-06-28 04:18:18 -04:00
ErrPreconditionFailed
2016-03-10 05:24:52 -05:00
ErrRequestTimeTooSkewed
ErrSignatureDoesNotMatch
ErrMethodNotAllowed
ErrInvalidPart
ErrInvalidPartOrder
2023-06-11 00:59:51 -04:00
ErrMissingPart
2016-03-10 05:24:52 -05:00
ErrAuthorizationHeaderMalformed
ErrMalformedPOSTRequest
2017-02-09 15:37:32 -05:00
ErrPOSTFileRequired
2016-03-10 05:24:52 -05:00
ErrSignatureVersionNotSupported
ErrBucketNotEmpty
ErrAllAccessDisabled
2022-12-06 11:07:24 -05:00
ErrPolicyInvalidVersion
2016-03-30 23:04:51 -04:00
ErrMissingFields
ErrMissingCredTag
ErrCredMalformed
ErrInvalidRegion
2020-03-18 20:25:45 -04:00
ErrInvalidServiceS3
ErrInvalidServiceSTS
2016-03-30 23:04:51 -04:00
ErrInvalidRequestVersion
ErrMissingSignTag
ErrMissingSignHeadersTag
ErrMalformedDate
2016-08-09 12:13:15 -04:00
ErrMalformedPresignedDate
ErrMalformedCredentialDate
2016-03-30 23:04:51 -04:00
ErrMalformedExpires
2016-08-09 12:13:15 -04:00
ErrNegativeExpires
2016-03-30 23:04:51 -04:00
ErrAuthHeaderEmpty
ErrExpiredPresignRequest
2016-09-10 03:38:07 -04:00
ErrRequestNotReadyYet
2016-08-09 12:13:15 -04:00
ErrUnsignedHeaders
2016-03-30 23:04:51 -04:00
ErrMissingDateHeader
ErrInvalidQuerySignatureAlgo
ErrInvalidQueryParams
2016-05-03 06:19:04 -04:00
ErrBucketAlreadyOwnedByYou
2017-01-04 02:39:22 -05:00
ErrInvalidDuration
2017-05-08 17:53:47 -04:00
ErrBucketAlreadyExists
2017-08-22 19:53:35 -04:00
ErrMetadataTooLarge
2017-09-12 19:14:41 -04:00
ErrUnsupportedMetadata
2023-06-21 12:41:59 -04:00
ErrUnsupportedHostHeader
2017-11-13 15:54:03 -05:00
ErrMaximumExpires
2023-06-18 21:20:15 -04:00
ErrSlowDownRead
ErrSlowDownWrite
2023-08-04 13:40:21 -04:00
ErrMaxVersionsExceeded
2018-01-18 17:39:39 -05:00
ErrInvalidPrefixMarker
2018-08-18 00:07:19 -04:00
ErrBadRequest
2019-07-12 00:38:12 -04:00
ErrKeyTooLongError
2019-11-20 16:18:09 -05:00
ErrInvalidBucketObjectLockConfiguration
2020-04-13 17:03:23 -04:00
ErrObjectLockConfigurationNotFound
2020-01-08 18:36:23 -05:00
ErrObjectLockConfigurationNotAllowed
2020-02-18 21:45:48 -05:00
ErrNoSuchObjectLockConfiguration
2019-11-20 16:18:09 -05:00
ErrObjectLocked
ErrInvalidRetentionDate
ErrPastObjectLockRetainDate
ErrUnknownWORMModeDirective
2020-05-05 17:18:13 -04:00
ErrBucketTaggingNotFound
2019-11-20 16:18:09 -05:00
ErrObjectLockInvalidHeaders
2020-01-20 11:45:59 -05:00
ErrInvalidTagDirective
2022-12-13 15:13:23 -05:00
ErrPolicyAlreadyAttached
ErrPolicyNotAttached
2023-05-05 22:53:12 -04:00
ErrExcessData
2016-03-10 05:24:52 -05:00
// Add new error codes here.
2016-04-20 20:23:23 -04:00
2022-08-16 14:28:30 -04:00
// SSE-S3/SSE-KMS related API errors
2018-08-03 19:55:45 -04:00
ErrInvalidEncryptionMethod
2022-08-16 14:28:30 -04:00
ErrInvalidEncryptionKeyID
2018-08-03 19:55:45 -04:00
2017-11-07 18:18:59 -05:00
// Server-Side-Encryption (with Customer provided key) related API errors.
ErrInsecureSSECustomerRequest
2018-03-01 14:37:57 -05:00
ErrSSEMultipartEncrypted
2017-11-07 18:18:59 -05:00
ErrSSEEncryptedObject
ErrInvalidEncryptionParameters
2023-01-24 18:46:33 -05:00
ErrInvalidEncryptionParametersSSEC
2017-11-07 18:18:59 -05:00
ErrInvalidSSECustomerAlgorithm
ErrInvalidSSECustomerKey
ErrMissingSSECustomerKey
ErrMissingSSECustomerKeyMD5
ErrSSECustomerKeyMD5Mismatch
2018-04-06 17:15:23 -04:00
ErrInvalidSSECustomerParameters
2018-08-17 15:52:14 -04:00
ErrIncompatibleEncryptionMethod
ErrKMSNotConfigured
2022-02-17 14:36:14 -05:00
ErrKMSKeyNotFoundException
2023-02-21 20:43:01 -05:00
ErrKMSDefaultKeyAlreadyConfigured
2017-11-07 18:18:59 -05:00
2018-11-07 09:40:03 -05:00
ErrNoAccessKey
ErrInvalidToken
2016-07-24 01:51:12 -04:00
// Bucket notification related errors.
ErrEventNotification
ErrARNNotification
ErrRegionNotification
ErrOverlappingFilterNotification
2016-07-25 20:53:55 -04:00
ErrFilterNameInvalid
ErrFilterNamePrefix
ErrFilterNameSuffix
2016-08-18 15:00:01 -04:00
ErrFilterValueInvalid
2016-08-23 21:42:30 -04:00
ErrOverlappingConfigs
2017-08-23 18:58:02 -04:00
ErrUnsupportedNotification
2016-07-24 01:51:12 -04:00
2016-07-05 04:04:50 -04:00
// S3 extended errors.
ErrContentSHA256Mismatch
2022-08-29 19:57:16 -04:00
ErrContentChecksumMismatch
2016-07-20 15:40:20 -04:00
2016-07-05 04:04:50 -04:00
// Add new extended error codes here.
2019-04-09 14:39:42 -04:00
// MinIO extended errors.
2016-05-08 15:36:16 -04:00
ErrStorageFull
2018-01-22 17:54:55 -05:00
ErrRequestBodyParse
2016-05-08 15:36:16 -04:00
ErrObjectExistsAsDirectory
2016-07-09 20:11:08 -04:00
ErrInvalidObjectName
2019-07-12 00:38:12 -04:00
ErrInvalidObjectNamePrefixSlash
2017-04-24 21:13:46 -04:00
ErrInvalidResourceName
2023-05-25 01:52:39 -04:00
ErrInvalidLifecycleQueryParameter
2016-08-10 21:47:49 -04:00
ErrServerNotInitialized
2024-04-22 13:49:30 -04:00
ErrBucketMetadataNotInitialized
2023-06-18 21:20:15 -04:00
ErrRequestTimedout
2020-10-30 12:33:16 -04:00
ErrClientDisconnected
2023-06-18 21:20:15 -04:00
ErrTooManyRequests
2017-11-14 19:56:24 -05:00
ErrInvalidRequest
2021-04-19 13:30:42 -04:00
ErrTransitionStorageClassNotFoundError
2019-04-09 14:39:42 -04:00
// MinIO storage class error codes
2017-12-26 23:36:16 -05:00
ErrInvalidStorageClass
2018-03-28 17:14:06 -04:00
ErrBackendDown
2016-07-05 04:04:50 -04:00
// Add new extended error codes here.
// Please open a https://github.com/minio/minio/issues before adding
// new error codes here.
2017-01-17 17:25:59 -05:00
2018-01-22 17:54:55 -05:00
ErrMalformedJSON
2018-10-16 15:48:19 -04:00
ErrAdminNoSuchUser
2023-05-26 09:31:24 -04:00
ErrAdminNoSuchUserLDAPWarn
2024-04-06 01:26:02 -04:00
ErrAdminLDAPExpectedLoginName
2019-08-02 17:25:00 -04:00
ErrAdminNoSuchGroup
ErrAdminGroupNotEmpty
2023-03-06 13:46:24 -05:00
ErrAdminGroupDisabled
2024-05-28 13:14:16 -04:00
ErrAdminInvalidGroupName
2022-10-03 05:10:15 -04:00
ErrAdminNoSuchJob
2018-10-16 15:48:19 -04:00
ErrAdminNoSuchPolicy
2022-12-09 16:08:33 -05:00
ErrAdminPolicyChangeAlreadyApplied
2018-10-16 15:48:19 -04:00
ErrAdminInvalidArgument
2017-01-17 17:25:59 -05:00
ErrAdminInvalidAccessKey
ErrAdminInvalidSecretKey
2017-02-27 14:40:27 -05:00
ErrAdminConfigNoQuorum
2018-01-11 02:06:36 -05:00
ErrAdminConfigTooLarge
ErrAdminConfigBadJSON
2022-07-05 21:18:04 -04:00
ErrAdminNoSuchConfigTarget
ErrAdminConfigEnvOverridden
2018-10-09 17:00:01 -04:00
ErrAdminConfigDuplicateKeys
2022-10-19 14:00:10 -04:00
ErrAdminConfigInvalidIDPType
2023-03-16 14:58:59 -04:00
ErrAdminConfigLDAPNonDefaultConfigName
2022-10-19 14:00:10 -04:00
ErrAdminConfigLDAPValidation
2022-10-31 17:52:26 -04:00
ErrAdminConfigIDPCfgNameAlreadyExists
ErrAdminConfigIDPCfgNameDoesNotExist
2017-05-31 23:33:13 -04:00
ErrInsecureClientRequest
2017-11-07 18:18:59 -05:00
ErrObjectTampered
2024-04-06 01:26:02 -04:00
ErrAdminLDAPNotEnabled
2021-10-06 19:36:31 -04:00
// Site-Replication errors
ErrSiteReplicationInvalidRequest
ErrSiteReplicationPeerResp
ErrSiteReplicationBackendIssue
ErrSiteReplicationServiceAccountError
ErrSiteReplicationBucketConfigError
ErrSiteReplicationBucketMetaError
ErrSiteReplicationIAMError
2022-05-06 15:40:34 -04:00
ErrSiteReplicationConfigMissing
2023-10-24 00:16:40 -04:00
ErrSiteReplicationIAMConfigMismatch
2021-10-06 19:36:31 -04:00
2022-10-25 15:36:57 -04:00
// Pool rebalance errors
ErrAdminRebalanceAlreadyStarted
ErrAdminRebalanceNotStarted
2020-04-30 18:55:54 -04:00
// Bucket Quota error codes
ErrAdminBucketQuotaExceeded
ErrAdminNoSuchQuotaConfiguration
2018-08-15 06:30:19 -04:00
2018-01-11 13:21:41 -05:00
ErrHealNotImplemented
2018-01-22 17:54:55 -05:00
ErrHealNoSuchProcess
ErrHealInvalidClientToken
ErrHealMissingBucket
ErrHealAlreadyRunning
ErrHealOverlappingPaths
2018-06-25 15:35:43 -04:00
ErrIncorrectContinuationToken
2018-08-15 06:30:19 -04:00
2019-02-12 04:25:52 -05:00
// S3 Select Errors
2018-08-15 06:30:19 -04:00
ErrEmptyRequestBody
ErrUnsupportedFunction
ErrInvalidExpressionType
ErrBusy
ErrUnauthorizedAccess
ErrExpressionTooLong
ErrIllegalSQLFunctionArgument
ErrInvalidKeyPath
ErrInvalidCompressionFormat
ErrInvalidFileHeaderInfo
ErrInvalidJSONType
ErrInvalidQuoteFields
ErrInvalidRequestParameter
ErrInvalidDataType
ErrInvalidTextEncoding
ErrInvalidDataSource
ErrInvalidTableAlias
ErrMissingRequiredParameter
ErrObjectSerializationConflict
ErrUnsupportedSQLOperation
ErrUnsupportedSQLStructure
ErrUnsupportedSyntax
ErrUnsupportedRangeHeader
ErrLexerInvalidChar
ErrLexerInvalidOperator
ErrLexerInvalidLiteral
ErrLexerInvalidIONLiteral
ErrParseExpectedDatePart
ErrParseExpectedKeyword
ErrParseExpectedTokenType
ErrParseExpected2TokenTypes
ErrParseExpectedNumber
ErrParseExpectedRightParenBuiltinFunctionCall
ErrParseExpectedTypeName
ErrParseExpectedWhenClause
ErrParseUnsupportedToken
ErrParseUnsupportedLiteralsGroupBy
ErrParseExpectedMember
ErrParseUnsupportedSelect
ErrParseUnsupportedCase
ErrParseUnsupportedCaseClause
ErrParseUnsupportedAlias
ErrParseUnsupportedSyntax
ErrParseUnknownOperator
ErrParseMissingIdentAfterAt
ErrParseUnexpectedOperator
ErrParseUnexpectedTerm
ErrParseUnexpectedToken
ErrParseUnexpectedKeyword
ErrParseExpectedExpression
ErrParseExpectedLeftParenAfterCast
ErrParseExpectedLeftParenValueConstructor
ErrParseExpectedLeftParenBuiltinFunctionCall
ErrParseExpectedArgumentDelimiter
ErrParseCastArity
ErrParseInvalidTypeParam
ErrParseEmptySelect
ErrParseSelectMissingFrom
ErrParseExpectedIdentForGroupName
ErrParseExpectedIdentForAlias
ErrParseUnsupportedCallWithStar
2024-02-22 01:26:06 -05:00
ErrParseNonUnaryAggregateFunctionCall
2018-08-15 06:30:19 -04:00
ErrParseMalformedJoin
ErrParseExpectedIdentForAt
ErrParseAsteriskIsNotAloneInSelectList
ErrParseCannotMixSqbAndWildcardInSelectList
ErrParseInvalidContextForWildcardInSelectList
ErrIncorrectSQLFunctionArgumentType
ErrValueParseFailure
ErrEvaluatorInvalidArguments
ErrIntegerOverflow
ErrLikeInvalidInputs
ErrCastFailed
ErrInvalidCast
ErrEvaluatorInvalidTimestampFormatPattern
ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing
ErrEvaluatorTimestampFormatPatternDuplicateFields
ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch
ErrEvaluatorUnterminatedTimestampFormatPatternToken
ErrEvaluatorInvalidTimestampFormatPatternToken
ErrEvaluatorInvalidTimestampFormatPatternSymbol
ErrEvaluatorBindingDoesNotExist
ErrMissingHeaders
2018-11-16 13:27:48 -05:00
ErrInvalidColumnIndex
2018-09-06 11:03:18 -04:00
ErrAdminConfigNotificationTargetsFailed
2018-09-27 13:34:37 -04:00
ErrAdminProfilerNotEnabled
2018-09-27 23:36:17 -04:00
ErrInvalidDecompressedSize
2019-02-07 20:25:58 -05:00
ErrAddUserInvalidArgument
2024-05-28 13:14:16 -04:00
ErrAddUserValidUTF
2022-05-02 12:27:35 -04:00
ErrAdminResourceInvalidArgument
2020-04-24 15:10:09 -04:00
ErrAdminAccountNotEligible
2020-11-27 20:23:57 -05:00
ErrAccountNotEligible
2021-04-15 01:51:14 -04:00
ErrAdminServiceAccountNotFound
2019-09-22 17:20:49 -04:00
ErrPostPolicyConditionInvalidFormat
2022-08-29 19:57:16 -04:00
ErrInvalidChecksum
2023-02-24 21:36:29 -05:00
2023-03-07 11:12:41 -05:00
// Lambda functions
ErrLambdaARNInvalid
ErrLambdaARNNotFound
2024-01-05 13:43:06 -05:00
// New Codes for GetObjectAttributes and GetObjectVersionAttributes
ErrInvalidAttributeName
2024-02-13 05:31:43 -05:00
ErrAdminNoAccessKey
ErrAdminNoSecretKey
2024-06-13 18:26:38 -04:00
ErrIAMNotInitialized
2023-02-24 21:36:29 -05:00
apiErrCodeEnd // This is used only for the testing code
2015-04-22 19:28:13 -04:00
)
2019-02-12 04:25:52 -05:00
type errorCodeMap map [ APIErrorCode ] APIError
2020-04-14 14:28:56 -04:00
func ( e errorCodeMap ) ToAPIErrWithErr ( errCode APIErrorCode , err error ) APIError {
2019-02-12 04:25:52 -05:00
apiErr , ok := e [ errCode ]
if ! ok {
2020-04-14 14:28:56 -04:00
apiErr = e [ ErrInternalError ]
}
if err != nil {
apiErr . Description = fmt . Sprintf ( "%s (%s)" , apiErr . Description , err )
2019-02-12 04:25:52 -05:00
}
2024-05-16 19:13:47 -04:00
if region := globalSite . Region ( ) ; region != "" {
2023-03-06 11:56:10 -05:00
if errCode == ErrAuthorizationHeaderMalformed {
2024-05-16 19:13:47 -04:00
apiErr . Description = fmt . Sprintf ( "The authorization header is malformed; the region is wrong; expecting '%s'." , region )
2021-04-08 19:40:38 -04:00
return apiErr
}
}
2019-02-12 04:25:52 -05:00
return apiErr
}
2020-04-14 14:28:56 -04:00
func ( e errorCodeMap ) ToAPIErr ( errCode APIErrorCode ) APIError {
return e . ToAPIErrWithErr ( errCode , nil )
}
2016-03-10 05:24:52 -05:00
// error code to APIError structure, these fields carry respective
// descriptions for all the error responses.
2019-02-12 04:25:52 -05:00
var errorCodes = errorCodeMap {
2016-03-10 05:24:52 -05:00
ErrInvalidCopyDest : {
2016-02-27 06:04:52 -05:00
Code : "InvalidRequest" ,
2016-12-26 19:29:26 -05:00
Description : "This copy request is illegal because it is trying to copy an object to itself without changing the object's metadata, storage class, website redirect location or encryption attributes." ,
2016-02-27 06:04:52 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidCopySource : {
2016-02-27 06:04:52 -05:00
Code : "InvalidArgument" ,
Description : "Copy Source must mention the source bucket and key: sourcebucket/sourcekey." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-12-26 19:29:26 -05:00
ErrInvalidMetadataDirective : {
Code : "InvalidArgument" ,
Description : "Unknown metadata directive." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-12-26 23:36:16 -05:00
ErrInvalidStorageClass : {
Code : "InvalidStorageClass" ,
Description : "Invalid storage class." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidRequestBody : {
2016-02-27 06:04:52 -05:00
Code : "InvalidArgument" ,
Description : "Body shouldn't be set for this request." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidMaxUploads : {
2015-07-16 20:22:45 -04:00
Code : "InvalidArgument" ,
2016-07-05 04:06:30 -04:00
Description : "Argument max-uploads must be an integer between 0 and 2147483647" ,
2015-07-16 20:22:45 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidMaxKeys : {
2015-07-16 20:22:45 -04:00
Code : "InvalidArgument" ,
2016-07-05 04:06:30 -04:00
Description : "Argument maxKeys must be an integer between 0 and 2147483647" ,
2015-07-16 20:22:45 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2019-02-24 01:14:24 -05:00
ErrInvalidEncodingMethod : {
Code : "InvalidArgument" ,
Description : "Invalid Encoding Method specified in Request" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidMaxParts : {
2015-07-16 20:22:45 -04:00
Code : "InvalidArgument" ,
2021-09-28 10:27:03 -04:00
Description : "Part number must be an integer between 1 and 10000, inclusive" ,
2015-07-16 20:22:45 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidPartNumberMarker : {
2015-07-16 20:22:45 -04:00
Code : "InvalidArgument" ,
2015-09-18 17:48:01 -04:00
Description : "Argument partNumberMarker must be an integer." ,
2015-07-16 20:22:45 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2021-01-22 15:09:24 -05:00
ErrInvalidPartNumber : {
Code : "InvalidPartNumber" ,
Description : "The requested partnumber is not satisfiable" ,
HTTPStatusCode : http . StatusRequestedRangeNotSatisfiable ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidPolicyDocument : {
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
Code : "InvalidPolicyDocument" ,
Description : "The content of the form does not meet the conditions specified in the policy document." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrAccessDenied : {
2015-02-11 06:23:15 -05:00
Code : "AccessDenied" ,
2015-09-18 17:48:01 -04:00
Description : "Access Denied." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusForbidden ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrBadDigest : {
2015-02-11 06:23:15 -05:00
Code : "BadDigest" ,
2016-03-05 19:43:48 -05:00
Description : "The Content-Md5 you specified did not match what we received." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrEntityTooSmall : {
2015-02-11 06:23:15 -05:00
Code : "EntityTooSmall" ,
Description : "Your proposed upload is smaller than the minimum allowed object size." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrEntityTooLarge : {
2015-02-11 06:23:15 -05:00
Code : "EntityTooLarge" ,
Description : "Your proposed upload exceeds the maximum allowed object size." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2023-05-05 22:53:12 -04:00
ErrExcessData : {
Code : "ExcessData" ,
Description : "More data provided than indicated content length" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2019-04-22 04:23:54 -04:00
ErrPolicyTooLarge : {
Code : "PolicyTooLarge" ,
Description : "Policy exceeds the maximum allowed document size." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrIncompleteBody : {
2015-02-11 06:23:15 -05:00
Code : "IncompleteBody" ,
2015-09-18 17:48:01 -04:00
Description : "You did not provide the number of bytes specified by the Content-Length HTTP header." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrInternalError : {
2015-02-11 06:23:15 -05:00
Code : "InternalError" ,
Description : "We encountered an internal error, please try again." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusInternalServerError ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidAccessKeyID : {
2017-05-23 23:07:52 -04:00
Code : "InvalidAccessKeyId" ,
2020-05-21 12:09:18 -04:00
Description : "The Access Key Id you provided does not exist in our records." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusForbidden ,
2015-02-11 06:23:15 -05:00
} ,
2021-12-22 14:40:21 -05:00
ErrAccessKeyDisabled : {
Code : "InvalidAccessKeyId" ,
Description : "Your account is disabled; please contact your administrator." ,
HTTPStatusCode : http . StatusForbidden ,
} ,
2023-06-12 16:22:07 -04:00
ErrInvalidArgument : {
Code : "InvalidArgument" ,
Description : "Invalid argument" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidBucketName : {
2015-02-11 06:23:15 -05:00
Code : "InvalidBucketName" ,
Description : "The specified bucket is not valid." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidDigest : {
2015-02-11 06:23:15 -05:00
Code : "InvalidDigest" ,
2016-03-05 19:43:48 -05:00
Description : "The Content-Md5 you specified is not valid." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidRange : {
2015-02-11 06:23:15 -05:00
Code : "InvalidRange" ,
2016-07-05 04:06:30 -04:00
Description : "The requested range is not satisfiable" ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusRequestedRangeNotSatisfiable ,
2015-02-11 06:23:15 -05:00
} ,
2021-04-07 17:37:10 -04:00
ErrInvalidRangePartNumber : {
Code : "InvalidRequest" ,
Description : "Cannot specify both Range header and partNumber query parameter" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrMalformedXML : {
2015-02-11 06:23:15 -05:00
Code : "MalformedXML" ,
Description : "The XML you provided was not well-formed or did not validate against our published schema." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrMissingContentLength : {
2015-02-11 06:23:15 -05:00
Code : "MissingContentLength" ,
Description : "You must provide the Content-Length HTTP header." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusLengthRequired ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrMissingContentMD5 : {
2016-03-05 19:43:48 -05:00
Code : "MissingContentMD5" ,
Description : "Missing required header for this request: Content-Md5." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-02-16 01:07:52 -05:00
ErrMissingSecurityHeader : {
Code : "MissingSecurityHeader" ,
Description : "Your request was missing a required header" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrMissingRequestBodyError : {
2015-02-11 06:23:15 -05:00
Code : "MissingRequestBodyError" ,
Description : "Request body is empty." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusLengthRequired ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrNoSuchBucket : {
2015-02-11 06:23:15 -05:00
Code : "NoSuchBucket" ,
2016-07-05 04:06:30 -04:00
Description : "The specified bucket does not exist" ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusNotFound ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrNoSuchBucketPolicy : {
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
Code : "NoSuchBucketPolicy" ,
2016-09-06 05:18:02 -04:00
Description : "The bucket policy does not exist" ,
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
HTTPStatusCode : http . StatusNotFound ,
} ,
2019-07-19 16:20:33 -04:00
ErrNoSuchBucketLifecycle : {
Code : "NoSuchBucketLifecycle" ,
Description : "The bucket lifecycle configuration does not exist" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2020-02-08 06:16:59 -05:00
ErrNoSuchLifecycleConfiguration : {
Code : "NoSuchLifecycleConfiguration" ,
Description : "The lifecycle configuration does not exist" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2021-11-19 20:54:10 -05:00
ErrInvalidLifecycleWithObjectLock : {
Code : "InvalidLifecycleWithObjectLock" ,
Description : "The lifecycle configuration containing MaxNoncurrentVersions is not supported with object locking" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-02-05 04:42:34 -05:00
ErrNoSuchBucketSSEConfig : {
Code : "ServerSideEncryptionConfigurationNotFoundError" ,
Description : "The server side encryption configuration was not found" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2016-03-10 05:24:52 -05:00
ErrNoSuchKey : {
2015-02-11 06:23:15 -05:00
Code : "NoSuchKey" ,
Description : "The specified key does not exist." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusNotFound ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrNoSuchUpload : {
2015-02-11 06:23:15 -05:00
Code : "NoSuchUpload" ,
2016-07-22 20:05:40 -04:00
Description : "The specified multipart upload does not exist. The upload ID may be invalid, or the upload may have been aborted or completed." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusNotFound ,
2018-12-12 14:43:44 -05:00
} ,
2020-11-29 00:15:45 -05:00
ErrInvalidVersionID : {
2020-06-12 23:04:01 -04:00
Code : "InvalidArgument" ,
Description : "Invalid version id specified" ,
HTTPStatusCode : http . StatusBadRequest ,
2015-02-11 06:23:15 -05:00
} ,
2020-11-29 00:15:45 -05:00
ErrNoSuchVersion : {
Code : "NoSuchVersion" ,
Description : "The specified version does not exist." ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2016-03-10 05:24:52 -05:00
ErrNotImplemented : {
2015-02-11 06:23:15 -05:00
Code : "NotImplemented" ,
2016-07-05 04:06:30 -04:00
Description : "A header you provided implies functionality that is not implemented" ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusNotImplemented ,
2015-02-11 06:23:15 -05:00
} ,
2016-06-28 04:18:18 -04:00
ErrPreconditionFailed : {
Code : "PreconditionFailed" ,
2016-07-09 15:13:40 -04:00
Description : "At least one of the pre-conditions you specified did not hold" ,
2016-06-28 04:18:18 -04:00
HTTPStatusCode : http . StatusPreconditionFailed ,
} ,
2016-03-10 05:24:52 -05:00
ErrRequestTimeTooSkewed : {
2015-02-11 06:23:15 -05:00
Code : "RequestTimeTooSkewed" ,
Description : "The difference between the request time and the server's time is too large." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusForbidden ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrSignatureDoesNotMatch : {
2015-02-11 06:23:15 -05:00
Code : "SignatureDoesNotMatch" ,
2016-06-21 15:10:18 -04:00
Description : "The request signature we calculated does not match the signature you provided. Check your key and signing method." ,
2015-03-06 00:07:19 -05:00
HTTPStatusCode : http . StatusForbidden ,
2015-02-11 06:23:15 -05:00
} ,
2016-03-10 05:24:52 -05:00
ErrMethodNotAllowed : {
2015-04-27 06:54:49 -04:00
Code : "MethodNotAllowed" ,
Description : "The specified method is not allowed against this resource." ,
HTTPStatusCode : http . StatusMethodNotAllowed ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidPart : {
2015-05-08 01:43:19 -04:00
Code : "InvalidPart" ,
2017-06-17 14:20:39 -04:00
Description : "One or more of the specified parts could not be found. The part may not have been uploaded, or the specified entity tag may not match the part's entity tag." ,
2015-05-08 01:43:19 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-06-11 00:59:51 -04:00
ErrMissingPart : {
Code : "InvalidRequest" ,
Description : "You must specify at least one part" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrInvalidPartOrder : {
2015-05-08 05:02:51 -04:00
Code : "InvalidPartOrder" ,
Description : "The list of parts was not in ascending order. The parts list must be specified in order by part number." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-10-20 19:09:55 -04:00
ErrInvalidObjectState : {
Code : "InvalidObjectState" ,
Description : "The operation is not valid for the current state of the object." ,
HTTPStatusCode : http . StatusForbidden ,
} ,
2016-03-10 05:24:52 -05:00
ErrAuthorizationHeaderMalformed : {
2015-09-18 17:48:01 -04:00
Code : "AuthorizationHeaderMalformed" ,
2015-11-23 16:39:57 -05:00
Description : "The authorization header is malformed; the region is wrong; expecting 'us-east-1'." ,
2015-09-18 17:48:01 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrMalformedPOSTRequest : {
2015-10-02 02:51:17 -04:00
Code : "MalformedPOSTRequest" ,
Description : "The body of your POST request is not well-formed multipart/form-data." ,
HTTPStatusCode : http . StatusBadRequest ,
2015-12-09 18:38:40 -05:00
} ,
2017-02-09 15:37:32 -05:00
ErrPOSTFileRequired : {
Code : "InvalidArgument" ,
Description : "POST requires exactly one file upload per request." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-10 05:24:52 -05:00
ErrSignatureVersionNotSupported : {
2015-12-09 18:38:40 -05:00
Code : "InvalidRequest" ,
Description : "The authorization mechanism you have provided is not supported. Please use AWS4-HMAC-SHA256." ,
HTTPStatusCode : http . StatusBadRequest ,
2015-10-02 02:51:17 -04:00
} ,
2016-03-10 05:24:52 -05:00
ErrBucketNotEmpty : {
2015-10-16 14:26:01 -04:00
Code : "BucketNotEmpty" ,
2016-09-06 05:18:02 -04:00
Description : "The bucket you tried to delete is not empty" ,
2015-10-16 14:26:01 -04:00
HTTPStatusCode : http . StatusConflict ,
} ,
2017-05-11 20:33:01 -04:00
ErrBucketAlreadyExists : {
Code : "BucketAlreadyExists" ,
Description : "The requested bucket name is not available. The bucket namespace is shared by all users of the system. Please select a different name and try again." ,
HTTPStatusCode : http . StatusConflict ,
} ,
2016-03-10 05:24:52 -05:00
ErrAllAccessDisabled : {
2016-02-16 21:50:36 -05:00
Code : "AllAccessDisabled" ,
2021-12-22 14:40:21 -05:00
Description : "All access to this resource has been disabled." ,
2016-02-16 21:50:36 -05:00
HTTPStatusCode : http . StatusForbidden ,
} ,
2022-12-06 11:07:24 -05:00
ErrPolicyInvalidVersion : {
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
Code : "MalformedPolicy" ,
2022-12-06 11:07:24 -05:00
Description : "The policy must contain a valid version string" ,
2016-03-30 23:04:51 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingFields : {
Code : "MissingFields" ,
Description : "Missing fields in request." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingCredTag : {
Code : "InvalidRequest" ,
Description : "Missing Credential field for this request." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrCredMalformed : {
2016-08-09 12:13:15 -04:00
Code : "AuthorizationQueryParametersError" ,
Description : "Error parsing the X-Amz-Credential parameter; the Credential is mal-formed; expecting \"<YOUR-AKID>/YYYYMMDD/REGION/SERVICE/aws4_request\"." ,
2016-03-30 23:04:51 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMalformedDate : {
Code : "MalformedDate" ,
Description : "Invalid date format header, expected to be in ISO8601, RFC1123 or RFC1123Z time format." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-08-09 12:13:15 -04:00
ErrMalformedPresignedDate : {
Code : "AuthorizationQueryParametersError" ,
Description : "X-Amz-Date must be in the ISO8601 Long Format \"yyyyMMdd'T'HHmmss'Z'\"" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMalformedCredentialDate : {
Code : "AuthorizationQueryParametersError" ,
2020-08-24 01:06:22 -04:00
Description : "Error parsing the X-Amz-Credential parameter; incorrect date format. This date in the credential must be in the format \"yyyyMMdd\"." ,
2016-08-09 12:13:15 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-03-30 23:04:51 -04:00
ErrInvalidRegion : {
Code : "InvalidRegion" ,
Description : "Region does not match." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-03-18 20:25:45 -04:00
ErrInvalidServiceS3 : {
Code : "AuthorizationParametersError" ,
Description : "Error parsing the Credential/X-Amz-Credential parameter; incorrect service. This endpoint belongs to \"s3\"." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidServiceSTS : {
Code : "AuthorizationParametersError" ,
Description : "Error parsing the Credential parameter; incorrect service. This endpoint belongs to \"sts\"." ,
2016-03-30 23:04:51 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidRequestVersion : {
2016-08-09 12:13:15 -04:00
Code : "AuthorizationQueryParametersError" ,
Description : "Error parsing the X-Amz-Credential parameter; incorrect terminal. This endpoint uses \"aws4_request\"." ,
2016-03-30 23:04:51 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingSignTag : {
Code : "AccessDenied" ,
Description : "Signature header missing Signature field." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingSignHeadersTag : {
Code : "InvalidArgument" ,
Description : "Signature header missing SignedHeaders field." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMalformedExpires : {
2016-08-09 12:13:15 -04:00
Code : "AuthorizationQueryParametersError" ,
Description : "X-Amz-Expires should be a number" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrNegativeExpires : {
Code : "AuthorizationQueryParametersError" ,
Description : "X-Amz-Expires must be non-negative" ,
2016-03-30 23:04:51 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrAuthHeaderEmpty : {
Code : "InvalidArgument" ,
Description : "Authorization header is invalid -- one and only one ' ' (space) required." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingDateHeader : {
Code : "AccessDenied" ,
Description : "AWS authentication requires a valid Date or x-amz-date header" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidQuerySignatureAlgo : {
Code : "AuthorizationQueryParametersError" ,
Description : "X-Amz-Algorithm only supports \"AWS4-HMAC-SHA256\"." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrExpiredPresignRequest : {
Code : "AccessDenied" ,
2016-08-09 12:13:15 -04:00
Description : "Request has expired" ,
2016-09-06 05:18:02 -04:00
HTTPStatusCode : http . StatusForbidden ,
2016-08-09 12:13:15 -04:00
} ,
2016-09-10 03:38:07 -04:00
ErrRequestNotReadyYet : {
Code : "AccessDenied" ,
Description : "Request is not valid yet" ,
HTTPStatusCode : http . StatusForbidden ,
} ,
2023-06-18 21:20:15 -04:00
ErrSlowDownRead : {
Code : "SlowDownRead" ,
2021-05-14 19:50:47 -04:00
Description : "Resource requested is unreadable, please reduce your request rate" ,
2017-12-20 03:00:14 -05:00
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2023-06-18 21:20:15 -04:00
ErrSlowDownWrite : {
Code : "SlowDownWrite" ,
Description : "Resource requested is unwritable, please reduce your request rate" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2023-08-04 13:40:21 -04:00
ErrMaxVersionsExceeded : {
Code : "MaxVersionsExceeded" ,
Description : "You've exceeded the limit on the number of versions you can create on this object" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-01-18 17:39:39 -05:00
ErrInvalidPrefixMarker : {
Code : "InvalidPrefixMarker" ,
Description : "Invalid marker prefix combination" ,
HTTPStatusCode : http . StatusBadRequest ,
2018-08-18 00:07:19 -04:00
} ,
ErrBadRequest : {
Code : "BadRequest" ,
Description : "400 BadRequest" ,
HTTPStatusCode : http . StatusBadRequest ,
2018-01-18 17:39:39 -05:00
} ,
2019-07-12 00:38:12 -04:00
ErrKeyTooLongError : {
Code : "KeyTooLongError" ,
Description : "Your key is too long" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-08-09 12:13:15 -04:00
ErrUnsignedHeaders : {
Code : "AccessDenied" ,
Description : "There were headers present in the request which were not signed" ,
2016-03-30 23:04:51 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidQueryParams : {
Code : "AuthorizationQueryParametersError" ,
Description : "Query-string authentication version 4 requires the X-Amz-Algorithm, X-Amz-Credential, X-Amz-Signature, X-Amz-Date, X-Amz-SignedHeaders, and X-Amz-Expires parameters." ,
accessPolicy: Implement Put, Get, Delete access policy.
This patch implements Get,Put,Delete bucket policies
Supporting - http://docs.aws.amazon.com/AmazonS3/latest/dev/access-policy-language-overview.html
Currently supports following actions.
"*": true,
"s3:*": true,
"s3:GetObject": true,
"s3:ListBucket": true,
"s3:PutObject": true,
"s3:CreateBucket": true,
"s3:GetBucketLocation": true,
"s3:DeleteBucket": true,
"s3:DeleteObject": true,
"s3:AbortMultipartUpload": true,
"s3:ListBucketMultipartUploads": true,
"s3:ListMultipartUploadParts": true,
following conditions for "StringEquals" and "StringNotEquals"
"s3:prefix", "s3:max-keys"
2016-02-03 19:46:56 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-05-03 06:19:04 -04:00
ErrBucketAlreadyOwnedByYou : {
Code : "BucketAlreadyOwnedByYou" ,
Description : "Your previous request to create the named bucket succeeded and you already own it." ,
HTTPStatusCode : http . StatusConflict ,
} ,
2017-01-04 02:39:22 -05:00
ErrInvalidDuration : {
Code : "InvalidDuration" ,
2017-02-01 14:17:30 -05:00
Description : "Duration provided in the request is invalid." ,
2017-01-04 02:39:22 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2019-11-20 16:18:09 -05:00
ErrInvalidBucketObjectLockConfiguration : {
Code : "InvalidRequest" ,
Description : "Bucket is missing ObjectLockConfiguration" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-05-05 17:18:13 -04:00
ErrBucketTaggingNotFound : {
Code : "NoSuchTagSet" ,
Description : "The TagSet does not exist" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2020-04-13 17:03:23 -04:00
ErrObjectLockConfigurationNotFound : {
Code : "ObjectLockConfigurationNotFoundError" ,
Description : "Object Lock configuration does not exist for this bucket" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2020-01-08 18:36:23 -05:00
ErrObjectLockConfigurationNotAllowed : {
Code : "InvalidBucketState" ,
2020-04-13 17:03:23 -04:00
Description : "Object Lock configuration cannot be enabled on existing buckets" ,
2020-01-08 18:36:23 -05:00
HTTPStatusCode : http . StatusConflict ,
} ,
2020-05-19 16:53:54 -04:00
ErrNoSuchCORSConfiguration : {
Code : "NoSuchCORSConfiguration" ,
Description : "The CORS configuration does not exist" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
ErrNoSuchWebsiteConfiguration : {
Code : "NoSuchWebsiteConfiguration" ,
Description : "The specified bucket does not have a website configuration" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
ErrReplicationConfigurationNotFoundError : {
Code : "ReplicationConfigurationNotFoundError" ,
Description : "The replication configuration was not found" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2020-10-08 13:54:11 -04:00
ErrRemoteDestinationNotFoundError : {
Code : "RemoteDestinationNotFoundError" ,
Description : "The remote destination bucket does not exist" ,
2020-07-21 20:49:56 -04:00
HTTPStatusCode : http . StatusNotFound ,
} ,
2020-08-05 02:02:27 -04:00
ErrReplicationDestinationMissingLock : {
Code : "ReplicationDestinationMissingLockError" ,
Description : "The replication destination bucket does not have object locking enabled" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-10-08 13:54:11 -04:00
ErrRemoteTargetNotFoundError : {
Code : "XMinioAdminRemoteTargetNotFoundError" ,
Description : "The remote target does not exist" ,
2020-07-21 20:49:56 -04:00
HTTPStatusCode : http . StatusNotFound ,
} ,
2020-09-04 11:48:38 -04:00
ErrReplicationRemoteConnectionError : {
2020-10-06 15:03:57 -04:00
Code : "XMinioAdminReplicationRemoteConnectionError" ,
2022-08-16 20:46:22 -04:00
Description : "Remote service connection error" ,
2024-06-05 21:01:15 -04:00
HTTPStatusCode : http . StatusServiceUnavailable ,
2020-09-04 11:48:38 -04:00
} ,
2021-06-24 21:29:30 -04:00
ErrReplicationBandwidthLimitError : {
Code : "XMinioAdminReplicationBandwidthLimitError" ,
2024-01-18 02:03:17 -05:00
Description : "Bandwidth limit for remote target must be at least 100MBps" ,
2021-06-24 21:29:30 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2022-06-06 05:54:39 -04:00
ErrReplicationNoExistingObjects : {
Code : "XMinioReplicationNoExistingObjects" ,
2024-10-01 18:13:18 -04:00
Description : "No matching ExistingObjects rule enabled" ,
2021-06-01 22:59:11 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-05-11 18:48:40 -04:00
ErrRemoteTargetDenyAddError : {
Code : "XMinioAdminRemoteTargetDenyAdd" ,
Description : "Cannot add remote target endpoint since this server is in a cluster replication setup" ,
2023-02-15 23:22:13 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2021-12-15 13:37:08 -05:00
ErrReplicationDenyEditError : {
Code : "XMinioReplicationDenyEdit" ,
Description : "Cannot alter local replication config since this server is in a cluster replication setup" ,
2022-05-11 16:44:16 -04:00
HTTPStatusCode : http . StatusBadRequest ,
2021-12-15 13:37:08 -05:00
} ,
2020-07-30 22:55:22 -04:00
ErrBucketRemoteIdenticalToSource : {
2020-10-06 15:03:57 -04:00
Code : "XMinioAdminRemoteIdenticalToSource" ,
2020-07-30 22:55:22 -04:00
Description : "The remote target cannot be identical to source" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrBucketRemoteAlreadyExists : {
2020-10-06 15:03:57 -04:00
Code : "XMinioAdminBucketRemoteAlreadyExists" ,
2020-07-30 22:55:22 -04:00
Description : "The remote target already exists" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-10-08 13:54:11 -04:00
ErrBucketRemoteLabelInUse : {
Code : "XMinioAdminBucketRemoteLabelInUse" ,
Description : "The remote target with this label already exists" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-07-30 22:55:22 -04:00
ErrBucketRemoteRemoveDisallowed : {
Code : "XMinioAdminRemoteRemoveDisallowed" ,
2020-10-08 13:54:11 -04:00
Description : "This ARN is in use by an existing configuration" ,
2020-07-30 22:55:22 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrBucketRemoteArnTypeInvalid : {
Code : "XMinioAdminRemoteARNTypeInvalid" ,
Description : "The bucket remote ARN type is not valid" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrBucketRemoteArnInvalid : {
Code : "XMinioAdminRemoteArnInvalid" ,
Description : "The bucket remote ARN does not have correct format" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-10-08 13:54:11 -04:00
ErrRemoteTargetNotVersionedError : {
Code : "RemoteTargetNotVersionedError" ,
Description : "The remote target does not have versioning enabled" ,
2020-07-30 22:55:22 -04:00
HTTPStatusCode : http . StatusBadRequest ,
2020-07-22 20:39:40 -04:00
} ,
2020-08-06 20:10:21 -04:00
ErrReplicationSourceNotVersionedError : {
Code : "ReplicationSourceNotVersionedError" ,
Description : "The replication source does not have versioning enabled" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-07-21 20:49:56 -04:00
ErrReplicationNeedsVersioningError : {
Code : "InvalidRequest" ,
Description : "Versioning must be 'Enabled' on the bucket to apply a replication configuration" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrReplicationBucketNeedsVersioningError : {
Code : "InvalidRequest" ,
Description : "Versioning must be 'Enabled' on the bucket to add a replication target" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-07-10 23:09:20 -04:00
ErrReplicationValidationError : {
Code : "InvalidRequest" ,
Description : "Replication validation failed on target" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrReplicationPermissionCheckError : {
Code : "ReplicationPermissionCheck" ,
Description : "X-Minio-Source-Replication-Check cannot be specified in request. Request cannot be completed" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-02-18 21:45:48 -05:00
ErrNoSuchObjectLockConfiguration : {
Code : "NoSuchObjectLockConfiguration" ,
Description : "The specified object does not have a ObjectLock configuration" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2019-11-20 16:18:09 -05:00
ErrObjectLocked : {
Code : "InvalidRequest" ,
Description : "Object is WORM protected and cannot be overwritten" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidRetentionDate : {
Code : "InvalidRequest" ,
Description : "Date must be provided in ISO 8601 format" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrPastObjectLockRetainDate : {
Code : "InvalidRequest" ,
Description : "the retain until date must be in the future" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnknownWORMModeDirective : {
Code : "InvalidRequest" ,
Description : "unknown wormMode directive" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrObjectLockInvalidHeaders : {
Code : "InvalidRequest" ,
Description : "x-amz-object-lock-retain-until-date and x-amz-object-lock-mode must both be supplied" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-11-12 15:12:09 -05:00
ErrObjectRestoreAlreadyInProgress : {
Code : "RestoreAlreadyInProgress" ,
Description : "Object restore is already in progress" ,
HTTPStatusCode : http . StatusConflict ,
} ,
2021-04-19 13:30:42 -04:00
ErrTransitionStorageClassNotFoundError : {
Code : "TransitionStorageClassNotFoundError" ,
Description : "The transition storage class was not found" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2021-11-16 12:28:29 -05:00
// Bucket notification related errors.
2016-07-24 01:51:12 -04:00
ErrEventNotification : {
Code : "InvalidArgument" ,
Description : "A specified event is not supported for notifications." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrARNNotification : {
Code : "InvalidArgument" ,
Description : "A specified destination ARN does not exist or is not well-formed. Verify the destination ARN." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrRegionNotification : {
Code : "InvalidArgument" ,
Description : "A specified destination is in a different region than the bucket. You must use a destination that resides in the same region as the bucket." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrOverlappingFilterNotification : {
Code : "InvalidArgument" ,
Description : "An object key name filtering rule defined with overlapping prefixes, overlapping suffixes, or overlapping combinations of prefixes and suffixes for the same event types." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-07-25 20:53:55 -04:00
ErrFilterNameInvalid : {
Code : "InvalidArgument" ,
Description : "filter rule name must be either prefix or suffix" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrFilterNamePrefix : {
Code : "InvalidArgument" ,
Description : "Cannot specify more than one prefix rule in a filter." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrFilterNameSuffix : {
Code : "InvalidArgument" ,
Description : "Cannot specify more than one suffix rule in a filter." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-08-18 15:00:01 -04:00
ErrFilterValueInvalid : {
2016-07-25 20:53:55 -04:00
Code : "InvalidArgument" ,
2016-08-18 15:00:01 -04:00
Description : "Size of filter rule value cannot exceed 1024 bytes in UTF-8 representation" ,
2016-07-25 20:53:55 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-08-23 21:42:30 -04:00
ErrOverlappingConfigs : {
Code : "InvalidArgument" ,
Description : "Configurations overlap. Configurations on the same bucket cannot share a common event type." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-08-23 18:58:02 -04:00
ErrUnsupportedNotification : {
Code : "UnsupportedNotification" ,
2019-04-09 14:39:42 -04:00
Description : "MinIO server does not support Topic or Cloud Function based notifications." ,
2017-08-23 18:58:02 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-03-03 19:32:04 -05:00
ErrInvalidCopyPartRange : {
Code : "InvalidArgument" ,
Description : "The x-amz-copy-source-range value must be of the form bytes=first-last where first and last are the zero-based offsets of the first and last bytes to copy" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidCopyPartRangeSource : {
Code : "InvalidArgument" ,
Description : "Range specified is not valid for source object" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-11-07 18:18:59 -05:00
ErrMetadataTooLarge : {
2020-09-14 00:26:35 -04:00
Code : "MetadataTooLarge" ,
2017-11-07 18:18:59 -05:00
Description : "Your metadata headers exceed the maximum allowed metadata size." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-01-20 11:45:59 -05:00
ErrInvalidTagDirective : {
Code : "InvalidArgument" ,
Description : "Unknown tag directive." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-08-03 19:55:45 -04:00
ErrInvalidEncryptionMethod : {
2023-06-13 16:52:33 -04:00
Code : "InvalidArgument" ,
Description : "Server Side Encryption with AWS KMS managed key requires HTTP header x-amz-server-side-encryption : aws:kms" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrIncompatibleEncryptionMethod : {
Code : "InvalidArgument" ,
Description : "Server Side Encryption with Customer provided key is incompatible with the encryption method specified" ,
2018-08-03 19:55:45 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2022-08-16 14:28:30 -04:00
ErrInvalidEncryptionKeyID : {
Code : "InvalidRequest" ,
Description : "The specified KMS KeyID contains unsupported characters" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-11-07 18:18:59 -05:00
ErrInsecureSSECustomerRequest : {
Code : "InvalidRequest" ,
2018-04-06 17:15:23 -04:00
Description : "Requests specifying Server Side Encryption with Customer provided keys must be made over a secure connection." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-03-01 14:37:57 -05:00
ErrSSEMultipartEncrypted : {
Code : "InvalidRequest" ,
Description : "The multipart upload initiate requested encryption. Subsequent part requests must include the appropriate encryption parameters." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-11-07 18:18:59 -05:00
ErrSSEEncryptedObject : {
Code : "InvalidRequest" ,
2018-04-06 17:15:23 -04:00
Description : "The object was stored using a form of Server Side Encryption. The correct parameters must be provided to retrieve the object." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidEncryptionParameters : {
Code : "InvalidRequest" ,
Description : "The encryption parameters are not applicable to this object." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-01-24 18:46:33 -05:00
ErrInvalidEncryptionParametersSSEC : {
Code : "InvalidRequest" ,
Description : "SSE-C encryption parameters are not supported on replicated bucket." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-11-07 18:18:59 -05:00
ErrInvalidSSECustomerAlgorithm : {
Code : "InvalidArgument" ,
2018-04-06 17:15:23 -04:00
Description : "Requests specifying Server Side Encryption with Customer provided keys must provide a valid encryption algorithm." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidSSECustomerKey : {
Code : "InvalidArgument" ,
2018-04-06 17:15:23 -04:00
Description : "The secret key was invalid for the specified algorithm." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingSSECustomerKey : {
Code : "InvalidArgument" ,
2018-04-06 17:15:23 -04:00
Description : "Requests specifying Server Side Encryption with Customer provided keys must provide an appropriate secret key." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingSSECustomerKeyMD5 : {
Code : "InvalidArgument" ,
2018-04-06 17:15:23 -04:00
Description : "Requests specifying Server Side Encryption with Customer provided keys must provide the client calculated MD5 of the secret key." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrSSECustomerKeyMD5Mismatch : {
Code : "InvalidArgument" ,
2018-04-06 17:15:23 -04:00
Description : "The calculated MD5 hash of the key did not match the hash that was provided." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidSSECustomerParameters : {
Code : "InvalidArgument" ,
Description : "The provided encryption parameters did not match the ones used originally." ,
2017-11-07 18:18:59 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-08-17 15:52:14 -04:00
ErrKMSNotConfigured : {
2021-05-06 13:45:33 -04:00
Code : "NotImplemented" ,
2018-08-17 15:52:14 -04:00
Description : "Server side encryption specified but KMS is not configured" ,
2021-05-06 13:45:33 -04:00
HTTPStatusCode : http . StatusNotImplemented ,
2018-08-17 15:52:14 -04:00
} ,
2022-02-17 14:36:14 -05:00
ErrKMSKeyNotFoundException : {
Code : "KMS.NotFoundException" ,
Description : "Invalid keyId" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-02-21 20:43:01 -05:00
ErrKMSDefaultKeyAlreadyConfigured : {
Code : "KMS.DefaultKeyAlreadyConfiguredException" ,
Description : "A default encryption already exists and cannot be changed on KMS" ,
HTTPStatusCode : http . StatusConflict ,
} ,
2018-11-07 09:40:03 -05:00
ErrNoAccessKey : {
Code : "AccessDenied" ,
Description : "No AWSAccessKey was presented" ,
HTTPStatusCode : http . StatusForbidden ,
} ,
ErrInvalidToken : {
Code : "InvalidTokenId" ,
Description : "The security token included in the request is invalid" ,
HTTPStatusCode : http . StatusForbidden ,
} ,
2016-07-24 01:51:12 -04:00
2021-11-16 12:28:29 -05:00
// S3 extensions.
2016-07-05 04:04:50 -04:00
ErrContentSHA256Mismatch : {
Code : "XAmzContentSHA256Mismatch" ,
Description : "The provided 'x-amz-content-sha256' header does not match what was computed." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2022-08-29 19:57:16 -04:00
ErrContentChecksumMismatch : {
Code : "XAmzContentChecksumMismatch" ,
Description : "The provided 'x-amz-checksum' header does not match what was computed." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-07-05 04:04:50 -04:00
2021-11-16 12:28:29 -05:00
// MinIO extensions.
2016-05-08 15:36:16 -04:00
ErrStorageFull : {
Code : "XMinioStorageFull" ,
2022-08-04 19:10:08 -04:00
Description : "Storage backend has reached its minimum free drive threshold. Please delete a few objects to proceed." ,
2018-07-03 12:40:14 -04:00
HTTPStatusCode : http . StatusInsufficientStorage ,
2016-05-08 15:36:16 -04:00
} ,
2018-01-22 17:54:55 -05:00
ErrRequestBodyParse : {
Code : "XMinioRequestBodyParse" ,
Description : "The request body failed to parse." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-05-08 15:36:16 -04:00
ErrObjectExistsAsDirectory : {
Code : "XMinioObjectExistsAsDirectory" ,
Description : "Object name already exists as a directory." ,
2022-05-11 16:44:16 -04:00
HTTPStatusCode : http . StatusBadRequest ,
2016-05-08 15:36:16 -04:00
} ,
2016-07-09 20:11:08 -04:00
ErrInvalidObjectName : {
Code : "XMinioInvalidObjectName" ,
2017-04-24 21:13:46 -04:00
Description : "Object name contains unsupported characters." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2019-07-12 00:38:12 -04:00
ErrInvalidObjectNamePrefixSlash : {
Code : "XMinioInvalidObjectName" ,
Description : "Object name contains a leading slash." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-04-24 21:13:46 -04:00
ErrInvalidResourceName : {
Code : "XMinioInvalidResourceName" ,
Description : "Resource name contains bad components such as \"..\" or \".\"." ,
2016-07-09 20:11:08 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2016-08-10 21:47:49 -04:00
ErrServerNotInitialized : {
Code : "XMinioServerNotInitialized" ,
2024-04-22 13:49:30 -04:00
Description : "Server not initialized yet, please try again." ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2024-06-13 18:26:38 -04:00
ErrIAMNotInitialized : {
Code : "XMinioIAMNotInitialized" ,
Description : "IAM sub-system not initialized yet, please try again." ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2024-04-22 13:49:30 -04:00
ErrBucketMetadataNotInitialized : {
Code : "XMinioBucketMetadataNotInitialized" ,
Description : "Bucket metadata not initialized yet, please try again." ,
2016-08-10 21:47:49 -04:00
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2018-01-22 17:54:55 -05:00
ErrMalformedJSON : {
Code : "XMinioMalformedJSON" ,
Description : "The JSON you provided was not well-formed or did not validate against our published format." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-05-25 01:52:39 -04:00
ErrInvalidLifecycleQueryParameter : {
Code : "XMinioInvalidLifecycleParameter" ,
Description : "The boolean value provided for withUpdatedAt query parameter was invalid." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-10-16 15:48:19 -04:00
ErrAdminNoSuchUser : {
Code : "XMinioAdminNoSuchUser" ,
Description : "The specified user does not exist." ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2023-05-26 09:31:24 -04:00
ErrAdminNoSuchUserLDAPWarn : {
Code : "XMinioAdminNoSuchUser" ,
Description : "The specified user does not exist. If you meant a user in LDAP, use `mc idp ldap`" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2019-08-02 17:25:00 -04:00
ErrAdminNoSuchGroup : {
Code : "XMinioAdminNoSuchGroup" ,
Description : "The specified group does not exist." ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2022-10-03 05:10:15 -04:00
ErrAdminNoSuchJob : {
Code : "XMinioAdminNoSuchJob" ,
Description : "The specified job does not exist." ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2019-08-02 17:25:00 -04:00
ErrAdminGroupNotEmpty : {
Code : "XMinioAdminGroupNotEmpty" ,
Description : "The specified group is not empty - cannot remove it." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-03-06 13:46:24 -05:00
ErrAdminGroupDisabled : {
Code : "XMinioAdminGroupDisabled" ,
Description : "The specified group is disabled." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-10-16 15:48:19 -04:00
ErrAdminNoSuchPolicy : {
Code : "XMinioAdminNoSuchPolicy" ,
Description : "The canned policy does not exist." ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2022-12-09 16:08:33 -05:00
ErrAdminPolicyChangeAlreadyApplied : {
Code : "XMinioAdminPolicyChangeAlreadyApplied" ,
Description : "The specified policy change is already in effect." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-10-16 15:48:19 -04:00
ErrAdminInvalidArgument : {
Code : "XMinioAdminInvalidArgument" ,
Description : "Invalid arguments specified." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-01-17 17:25:59 -05:00
ErrAdminInvalidAccessKey : {
Code : "XMinioAdminInvalidAccessKey" ,
Description : "The access key is invalid." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrAdminInvalidSecretKey : {
Code : "XMinioAdminInvalidSecretKey" ,
Description : "The secret key is invalid." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2024-02-13 05:31:43 -05:00
ErrAdminNoAccessKey : {
Code : "XMinioAdminNoAccessKey" ,
Description : "No access key was provided." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrAdminNoSecretKey : {
Code : "XMinioAdminNoSecretKey" ,
Description : "No secret key was provided." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-02-27 14:40:27 -05:00
ErrAdminConfigNoQuorum : {
Code : "XMinioAdminConfigNoQuorum" ,
Description : "Configuration update failed because server quorum was not met" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2018-01-11 02:06:36 -05:00
ErrAdminConfigTooLarge : {
Code : "XMinioAdminConfigTooLarge" ,
Description : fmt . Sprintf ( "Configuration data provided exceeds the allowed maximum of %d bytes" ,
2018-10-09 17:00:01 -04:00
maxEConfigJSONSize ) ,
2018-01-11 02:06:36 -05:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
2022-07-05 21:18:04 -04:00
ErrAdminNoSuchConfigTarget : {
Code : "XMinioAdminNoSuchConfigTarget" ,
Description : "No such named configuration target exists" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-01-11 02:06:36 -05:00
ErrAdminConfigBadJSON : {
Code : "XMinioAdminConfigBadJSON" ,
2018-10-09 17:00:01 -04:00
Description : "JSON configuration provided is of incorrect format" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2022-07-05 21:18:04 -04:00
ErrAdminConfigEnvOverridden : {
Code : "XMinioAdminConfigEnvOverridden" ,
Description : "Unable to update config via Admin API due to environment variable override" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-10-09 17:00:01 -04:00
ErrAdminConfigDuplicateKeys : {
Code : "XMinioAdminConfigDuplicateKeys" ,
2018-01-11 02:06:36 -05:00
Description : "JSON configuration provided has objects with duplicate keys" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2022-10-19 14:00:10 -04:00
ErrAdminConfigInvalidIDPType : {
Code : "XMinioAdminConfigInvalidIDPType" ,
Description : fmt . Sprintf ( "Invalid IDP configuration type - must be one of %v" , madmin . ValidIDPConfigTypes ) ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-03-16 14:58:59 -04:00
ErrAdminConfigLDAPNonDefaultConfigName : {
Code : "XMinioAdminConfigLDAPNonDefaultConfigName" ,
Description : "Only a single LDAP configuration is supported - config name must be empty or `_`" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2022-10-19 14:00:10 -04:00
ErrAdminConfigLDAPValidation : {
Code : "XMinioAdminConfigLDAPValidation" ,
Description : "LDAP Configuration validation failed" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2022-10-31 17:52:26 -04:00
ErrAdminConfigIDPCfgNameAlreadyExists : {
Code : "XMinioAdminConfigIDPCfgNameAlreadyExists" ,
2023-07-21 11:45:08 -04:00
Description : "An IDP configuration with the given name already exists" ,
2022-10-31 17:52:26 -04:00
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrAdminConfigIDPCfgNameDoesNotExist : {
Code : "XMinioAdminConfigIDPCfgNameDoesNotExist" ,
Description : "No such IDP configuration exists" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-09-06 11:03:18 -04:00
ErrAdminConfigNotificationTargetsFailed : {
Code : "XMinioAdminNotificationTargetsTestFailed" ,
Description : "Configuration update failed due an unsuccessful attempt to connect to one or more notification servers" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-09-27 13:34:37 -04:00
ErrAdminProfilerNotEnabled : {
Code : "XMinioAdminProfilerNotEnabled" ,
Description : "Unable to perform the requested operation because profiling is not enabled" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-04-30 18:55:54 -04:00
ErrAdminBucketQuotaExceeded : {
Code : "XMinioAdminBucketQuotaExceeded" ,
Description : "Bucket quota exceeded" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrAdminNoSuchQuotaConfiguration : {
Code : "XMinioAdminNoSuchQuotaConfiguration" ,
Description : "The quota configuration does not exist" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2017-05-31 23:33:13 -04:00
ErrInsecureClientRequest : {
Code : "XMinioInsecureClientRequest" ,
Description : "Cannot respond to plain-text request from TLS-encrypted server" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-06-18 21:20:15 -04:00
ErrRequestTimedout : {
2020-06-08 14:28:40 -04:00
Code : "RequestTimeout" ,
Description : "A timeout occurred while trying to lock a resource, please reduce your request rate" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
2017-08-31 14:29:22 -04:00
} ,
2020-10-30 12:33:16 -04:00
ErrClientDisconnected : {
Code : "ClientDisconnected" ,
Description : "Client disconnected before response was ready" ,
HTTPStatusCode : 499 , // No official code, use nginx value.
} ,
2023-06-18 21:20:15 -04:00
ErrTooManyRequests : {
Code : "TooManyRequests" ,
2024-08-16 04:43:49 -04:00
Description : "Please reduce your request rate" ,
2024-05-07 16:41:56 -04:00
HTTPStatusCode : http . StatusTooManyRequests ,
2020-03-24 15:43:40 -04:00
} ,
2017-09-12 19:14:41 -04:00
ErrUnsupportedMetadata : {
Code : "InvalidArgument" ,
Description : "Your metadata headers are not supported." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-06-21 12:41:59 -04:00
ErrUnsupportedHostHeader : {
Code : "InvalidArgument" ,
Description : "Your Host header is malformed." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2017-11-07 18:18:59 -05:00
ErrObjectTampered : {
Code : "XMinioObjectTampered" ,
Description : errObjectTampered . Error ( ) ,
HTTPStatusCode : http . StatusPartialContent ,
} ,
2021-10-06 19:36:31 -04:00
ErrSiteReplicationInvalidRequest : {
Code : "XMinioSiteReplicationInvalidRequest" ,
Description : "Invalid site-replication request" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrSiteReplicationPeerResp : {
Code : "XMinioSiteReplicationPeerResp" ,
Description : "Error received when contacting a peer site" ,
2022-12-22 04:31:20 -05:00
HTTPStatusCode : http . StatusBadRequest ,
2021-10-06 19:36:31 -04:00
} ,
ErrSiteReplicationBackendIssue : {
Code : "XMinioSiteReplicationBackendIssue" ,
Description : "Error when requesting object layer backend" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
ErrSiteReplicationServiceAccountError : {
Code : "XMinioSiteReplicationServiceAccountError" ,
Description : "Site replication related service account error" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
ErrSiteReplicationBucketConfigError : {
Code : "XMinioSiteReplicationBucketConfigError" ,
Description : "Error while configuring replication on a bucket" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
ErrSiteReplicationBucketMetaError : {
Code : "XMinioSiteReplicationBucketMetaError" ,
Description : "Error while replicating bucket metadata" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
ErrSiteReplicationIAMError : {
Code : "XMinioSiteReplicationIAMError" ,
Description : "Error while replicating an IAM item" ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
2022-05-06 15:40:34 -04:00
ErrSiteReplicationConfigMissing : {
Code : "XMinioSiteReplicationConfigMissingError" ,
Description : "Site not found in site replication configuration" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-10-24 00:16:40 -04:00
ErrSiteReplicationIAMConfigMismatch : {
Code : "XMinioSiteReplicationIAMConfigMismatch" ,
Description : "IAM configuration mismatch between sites" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2022-10-25 15:36:57 -04:00
ErrAdminRebalanceAlreadyStarted : {
Code : "XMinioAdminRebalanceAlreadyStarted" ,
Description : "Pool rebalance is already started" ,
HTTPStatusCode : http . StatusConflict ,
} ,
ErrAdminRebalanceNotStarted : {
Code : "XMinioAdminRebalanceNotStarted" ,
Description : "Pool rebalance is not started" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2017-11-13 15:54:03 -05:00
ErrMaximumExpires : {
Code : "AuthorizationQueryParametersError" ,
Description : "X-Amz-Expires must be less than a week (in seconds); that is, the given X-Amz-Expires must be less than 604800 seconds" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-08-15 06:30:19 -04:00
2017-11-14 19:56:24 -05:00
// Generic Invalid-Request error. Should be used for response errors only for unlikely
2018-04-05 18:04:40 -04:00
// corner case errors for which introducing new APIErrorCode is not worth it. LogIf()
2017-11-14 19:56:24 -05:00
// should be used to log the error at the source of the error for debugging purposes.
ErrInvalidRequest : {
Code : "InvalidRequest" ,
Description : "Invalid Request" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-01-22 17:54:55 -05:00
ErrHealNotImplemented : {
Code : "XMinioHealNotImplemented" ,
Description : "This server does not implement heal functionality." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrHealNoSuchProcess : {
Code : "XMinioHealNoSuchProcess" ,
Description : "No such heal process is running on the server" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrHealInvalidClientToken : {
Code : "XMinioHealInvalidClientToken" ,
Description : "Client token mismatch" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrHealMissingBucket : {
Code : "XMinioHealMissingBucket" ,
Description : "A heal start request with a non-empty object-prefix parameter requires a bucket to be specified." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrHealAlreadyRunning : {
Code : "XMinioHealAlreadyRunning" ,
Description : "" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrHealOverlappingPaths : {
Code : "XMinioHealOverlappingPaths" ,
Description : "" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-03-28 17:14:06 -04:00
ErrBackendDown : {
Code : "XMinioBackendDown" ,
2021-11-11 01:33:17 -05:00
Description : "Remote backend is unreachable" ,
HTTPStatusCode : http . StatusBadRequest ,
2018-03-28 17:14:06 -04:00
} ,
2018-06-25 15:35:43 -04:00
ErrIncorrectContinuationToken : {
Code : "InvalidArgument" ,
Description : "The continuation token provided is incorrect" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2021-11-16 12:28:29 -05:00
// S3 Select API Errors
2018-08-15 06:30:19 -04:00
ErrEmptyRequestBody : {
Code : "EmptyRequestBody" ,
Description : "Request body cannot be empty." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnsupportedFunction : {
Code : "UnsupportedFunction" ,
Description : "Encountered an unsupported SQL function." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidDataSource : {
Code : "InvalidDataSource" ,
Description : "Invalid data source type. Only CSV and JSON are supported at this time." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidExpressionType : {
Code : "InvalidExpressionType" ,
Description : "The ExpressionType is invalid. Only SQL expressions are supported at this time." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrBusy : {
2023-02-27 11:34:52 -05:00
Code : "ServerBusy" ,
2018-08-15 06:30:19 -04:00
Description : "The service is unavailable. Please retry." ,
HTTPStatusCode : http . StatusServiceUnavailable ,
} ,
ErrUnauthorizedAccess : {
Code : "UnauthorizedAccess" ,
Description : "You are not authorized to perform this operation" ,
HTTPStatusCode : http . StatusUnauthorized ,
} ,
ErrExpressionTooLong : {
Code : "ExpressionTooLong" ,
Description : "The SQL expression is too long: The maximum byte-length for the SQL expression is 256 KB." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrIllegalSQLFunctionArgument : {
Code : "IllegalSqlFunctionArgument" ,
Description : "Illegal argument was used in the SQL function." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidKeyPath : {
Code : "InvalidKeyPath" ,
Description : "Key path in the SQL expression is invalid." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidCompressionFormat : {
Code : "InvalidCompressionFormat" ,
Description : "The file is not in a supported compression format. Only GZIP is supported at this time." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidFileHeaderInfo : {
Code : "InvalidFileHeaderInfo" ,
Description : "The FileHeaderInfo is invalid. Only NONE, USE, and IGNORE are supported." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidJSONType : {
Code : "InvalidJsonType" ,
Description : "The JsonType is invalid. Only DOCUMENT and LINES are supported at this time." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidQuoteFields : {
Code : "InvalidQuoteFields" ,
Description : "The QuoteFields is invalid. Only ALWAYS and ASNEEDED are supported." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidRequestParameter : {
Code : "InvalidRequestParameter" ,
Description : "The value of a parameter in SelectRequest element is invalid. Check the service API documentation and try again." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidDataType : {
Code : "InvalidDataType" ,
Description : "The SQL expression contains an invalid data type." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidTextEncoding : {
Code : "InvalidTextEncoding" ,
Description : "Invalid encoding type. Only UTF-8 encoding is supported at this time." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidTableAlias : {
Code : "InvalidTableAlias" ,
Description : "The SQL expression contains an invalid table alias." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingRequiredParameter : {
Code : "MissingRequiredParameter" ,
Description : "The SelectRequest entity is missing a required parameter. Check the service documentation and try again." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrObjectSerializationConflict : {
Code : "ObjectSerializationConflict" ,
Description : "The SelectRequest entity can only contain one of CSV or JSON. Check the service documentation and try again." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnsupportedSQLOperation : {
Code : "UnsupportedSqlOperation" ,
Description : "Encountered an unsupported SQL operation." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnsupportedSQLStructure : {
Code : "UnsupportedSqlStructure" ,
Description : "Encountered an unsupported SQL structure. Check the SQL Reference." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnsupportedSyntax : {
Code : "UnsupportedSyntax" ,
Description : "Encountered invalid syntax." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrUnsupportedRangeHeader : {
Code : "UnsupportedRangeHeader" ,
Description : "Range header is not supported for this operation." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrLexerInvalidChar : {
Code : "LexerInvalidChar" ,
Description : "The SQL expression contains an invalid character." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrLexerInvalidOperator : {
Code : "LexerInvalidOperator" ,
Description : "The SQL expression contains an invalid literal." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrLexerInvalidLiteral : {
Code : "LexerInvalidLiteral" ,
Description : "The SQL expression contains an invalid operator." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrLexerInvalidIONLiteral : {
Code : "LexerInvalidIONLiteral" ,
Description : "The SQL expression contains an invalid operator." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedDatePart : {
Code : "ParseExpectedDatePart" ,
Description : "Did not find the expected date part in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedKeyword : {
Code : "ParseExpectedKeyword" ,
Description : "Did not find the expected keyword in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedTokenType : {
Code : "ParseExpectedTokenType" ,
Description : "Did not find the expected token in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpected2TokenTypes : {
Code : "ParseExpected2TokenTypes" ,
Description : "Did not find the expected token in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedNumber : {
Code : "ParseExpectedNumber" ,
Description : "Did not find the expected number in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedRightParenBuiltinFunctionCall : {
Code : "ParseExpectedRightParenBuiltinFunctionCall" ,
Description : "Did not find the expected right parenthesis character in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedTypeName : {
Code : "ParseExpectedTypeName" ,
Description : "Did not find the expected type name in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedWhenClause : {
Code : "ParseExpectedWhenClause" ,
Description : "Did not find the expected WHEN clause in the SQL expression. CASE is not supported." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedToken : {
Code : "ParseUnsupportedToken" ,
Description : "The SQL expression contains an unsupported token." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedLiteralsGroupBy : {
Code : "ParseUnsupportedLiteralsGroupBy" ,
Description : "The SQL expression contains an unsupported use of GROUP BY." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedMember : {
Code : "ParseExpectedMember" ,
Description : "The SQL expression contains an unsupported use of MEMBER." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedSelect : {
Code : "ParseUnsupportedSelect" ,
Description : "The SQL expression contains an unsupported use of SELECT." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedCase : {
Code : "ParseUnsupportedCase" ,
Description : "The SQL expression contains an unsupported use of CASE." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedCaseClause : {
Code : "ParseUnsupportedCaseClause" ,
Description : "The SQL expression contains an unsupported use of CASE." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedAlias : {
Code : "ParseUnsupportedAlias" ,
Description : "The SQL expression contains an unsupported use of ALIAS." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedSyntax : {
Code : "ParseUnsupportedSyntax" ,
Description : "The SQL expression contains unsupported syntax." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnknownOperator : {
Code : "ParseUnknownOperator" ,
Description : "The SQL expression contains an invalid operator." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseMissingIdentAfterAt : {
Code : "ParseMissingIdentAfterAt" ,
Description : "Did not find the expected identifier after the @ symbol in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnexpectedOperator : {
Code : "ParseUnexpectedOperator" ,
Description : "The SQL expression contains an unexpected operator." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnexpectedTerm : {
Code : "ParseUnexpectedTerm" ,
Description : "The SQL expression contains an unexpected term." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnexpectedToken : {
Code : "ParseUnexpectedToken" ,
Description : "The SQL expression contains an unexpected token." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnexpectedKeyword : {
Code : "ParseUnexpectedKeyword" ,
Description : "The SQL expression contains an unexpected keyword." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedExpression : {
Code : "ParseExpectedExpression" ,
Description : "Did not find the expected SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedLeftParenAfterCast : {
Code : "ParseExpectedLeftParenAfterCast" ,
Description : "Did not find expected the left parenthesis in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedLeftParenValueConstructor : {
Code : "ParseExpectedLeftParenValueConstructor" ,
Description : "Did not find expected the left parenthesis in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedLeftParenBuiltinFunctionCall : {
Code : "ParseExpectedLeftParenBuiltinFunctionCall" ,
Description : "Did not find the expected left parenthesis in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedArgumentDelimiter : {
Code : "ParseExpectedArgumentDelimiter" ,
Description : "Did not find the expected argument delimiter in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseCastArity : {
Code : "ParseCastArity" ,
Description : "The SQL expression CAST has incorrect arity." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseInvalidTypeParam : {
Code : "ParseInvalidTypeParam" ,
Description : "The SQL expression contains an invalid parameter value." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseEmptySelect : {
Code : "ParseEmptySelect" ,
Description : "The SQL expression contains an empty SELECT." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseSelectMissingFrom : {
Code : "ParseSelectMissingFrom" ,
Description : "GROUP is not supported in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedIdentForGroupName : {
Code : "ParseExpectedIdentForGroupName" ,
Description : "GROUP is not supported in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedIdentForAlias : {
Code : "ParseExpectedIdentForAlias" ,
Description : "Did not find the expected identifier for the alias in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseUnsupportedCallWithStar : {
Code : "ParseUnsupportedCallWithStar" ,
Description : "Only COUNT with (*) as a parameter is supported in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2024-02-22 01:26:06 -05:00
ErrParseNonUnaryAggregateFunctionCall : {
Code : "ParseNonUnaryAggregateFunctionCall" ,
2018-08-15 06:30:19 -04:00
Description : "Only one argument is supported for aggregate functions in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseMalformedJoin : {
Code : "ParseMalformedJoin" ,
Description : "JOIN is not supported in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseExpectedIdentForAt : {
Code : "ParseExpectedIdentForAt" ,
Description : "Did not find the expected identifier for AT name in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseAsteriskIsNotAloneInSelectList : {
Code : "ParseAsteriskIsNotAloneInSelectList" ,
Description : "Other expressions are not allowed in the SELECT list when '*' is used without dot notation in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseCannotMixSqbAndWildcardInSelectList : {
Code : "ParseCannotMixSqbAndWildcardInSelectList" ,
Description : "Cannot mix [] and * in the same expression in a SELECT list in SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrParseInvalidContextForWildcardInSelectList : {
Code : "ParseInvalidContextForWildcardInSelectList" ,
Description : "Invalid use of * in SELECT list in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrIncorrectSQLFunctionArgumentType : {
Code : "IncorrectSqlFunctionArgumentType" ,
Description : "Incorrect type of arguments in function call in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrValueParseFailure : {
Code : "ValueParseFailure" ,
Description : "Time stamp parse failure in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorInvalidArguments : {
Code : "EvaluatorInvalidArguments" ,
Description : "Incorrect number of arguments in the function call in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrIntegerOverflow : {
Code : "IntegerOverflow" ,
Description : "Int overflow or underflow in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrLikeInvalidInputs : {
Code : "LikeInvalidInputs" ,
Description : "Invalid argument given to the LIKE clause in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrCastFailed : {
Code : "CastFailed" ,
Description : "Attempt to convert from one data type to another using CAST failed in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrInvalidCast : {
Code : "InvalidCast" ,
Description : "Attempt to convert from one data type to another using CAST failed in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorInvalidTimestampFormatPattern : {
Code : "EvaluatorInvalidTimestampFormatPattern" ,
Description : "Time stamp format pattern requires additional fields in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorInvalidTimestampFormatPatternSymbolForParsing : {
Code : "EvaluatorInvalidTimestampFormatPatternSymbolForParsing" ,
Description : "Time stamp format pattern contains a valid format symbol that cannot be applied to time stamp parsing in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorTimestampFormatPatternDuplicateFields : {
Code : "EvaluatorTimestampFormatPatternDuplicateFields" ,
Description : "Time stamp format pattern contains multiple format specifiers representing the time stamp field in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorTimestampFormatPatternHourClockAmPmMismatch : {
Code : "EvaluatorUnterminatedTimestampFormatPatternToken" ,
Description : "Time stamp format pattern contains unterminated token in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorUnterminatedTimestampFormatPatternToken : {
Code : "EvaluatorInvalidTimestampFormatPatternToken" ,
Description : "Time stamp format pattern contains an invalid token in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorInvalidTimestampFormatPatternToken : {
Code : "EvaluatorInvalidTimestampFormatPatternToken" ,
Description : "Time stamp format pattern contains an invalid token in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorInvalidTimestampFormatPatternSymbol : {
Code : "EvaluatorInvalidTimestampFormatPatternSymbol" ,
Description : "Time stamp format pattern contains an invalid symbol in the SQL expression." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrEvaluatorBindingDoesNotExist : {
Code : "ErrEvaluatorBindingDoesNotExist" ,
Description : "A column name or a path provided does not exist in the SQL expression" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrMissingHeaders : {
Code : "MissingHeaders" ,
Description : "Some headers in the query are missing from the file. Check the file and try again." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-11-16 13:27:48 -05:00
ErrInvalidColumnIndex : {
Code : "InvalidColumnIndex" ,
Description : "The column index is invalid. Please check the service documentation and try again." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2018-09-27 23:36:17 -04:00
ErrInvalidDecompressedSize : {
Code : "XMinioInvalidDecompressedSize" ,
Description : "The data provided is unfit for decompression" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2019-02-07 20:25:58 -05:00
ErrAddUserInvalidArgument : {
Code : "XMinioInvalidIAMCredentials" ,
2024-02-14 13:37:12 -05:00
Description : "Credential is not allowed to be same as admin access key" ,
2020-11-27 20:23:57 -05:00
HTTPStatusCode : http . StatusForbidden ,
2019-02-07 20:25:58 -05:00
} ,
2022-05-02 12:27:35 -04:00
ErrAdminResourceInvalidArgument : {
Code : "XMinioInvalidResource" ,
Description : "Policy, user or group names are not allowed to begin or end with space characters" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2020-04-24 15:10:09 -04:00
ErrAdminAccountNotEligible : {
2020-04-14 14:28:56 -04:00
Code : "XMinioInvalidIAMCredentials" ,
2020-04-24 15:10:09 -04:00
Description : "The administrator key is not eligible for this operation" ,
2020-11-27 20:23:57 -05:00
HTTPStatusCode : http . StatusForbidden ,
} ,
ErrAccountNotEligible : {
Code : "XMinioInvalidIAMCredentials" ,
Description : "The account key is not eligible for this operation" ,
HTTPStatusCode : http . StatusForbidden ,
2020-04-14 14:28:56 -04:00
} ,
2021-04-15 01:51:14 -04:00
ErrAdminServiceAccountNotFound : {
2020-04-24 15:10:09 -04:00
Code : "XMinioInvalidIAMCredentials" ,
Description : "The specified service account is not found" ,
HTTPStatusCode : http . StatusNotFound ,
2020-03-17 13:36:13 -04:00
} ,
2019-09-22 17:20:49 -04:00
ErrPostPolicyConditionInvalidFormat : {
Code : "PostPolicyInvalidKeyName" ,
Description : "Invalid according to Policy: Policy Condition failed" ,
HTTPStatusCode : http . StatusForbidden ,
} ,
2022-08-29 19:57:16 -04:00
ErrInvalidChecksum : {
Code : "InvalidArgument" ,
Description : "Invalid checksum provided." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2023-03-07 11:12:41 -05:00
ErrLambdaARNInvalid : {
Code : "LambdaARNInvalid" ,
Description : "The specified lambda ARN is invalid" ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrLambdaARNNotFound : {
Code : "LambdaARNNotFound" ,
Description : "The specified lambda ARN does not exist" ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2022-12-13 15:13:23 -05:00
ErrPolicyAlreadyAttached : {
Code : "XMinioPolicyAlreadyAttached" ,
Description : "The specified policy is already attached." ,
HTTPStatusCode : http . StatusConflict ,
} ,
ErrPolicyNotAttached : {
Code : "XMinioPolicyNotAttached" ,
Description : "The specified policy is not found." ,
HTTPStatusCode : http . StatusNotFound ,
} ,
2024-01-05 13:43:06 -05:00
ErrInvalidAttributeName : {
Code : "InvalidArgument" ,
Description : "Invalid attribute name specified." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2024-04-06 01:26:02 -04:00
ErrAdminLDAPNotEnabled : {
Code : "XMinioLDAPNotEnabled" ,
Description : "LDAP is not enabled. LDAP must be enabled to make LDAP requests." ,
HTTPStatusCode : http . StatusNotImplemented ,
} ,
ErrAdminLDAPExpectedLoginName : {
Code : "XMinioLDAPExpectedLoginName" ,
Description : "Expected LDAP short username but was given full DN." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2024-05-28 13:14:16 -04:00
ErrAdminInvalidGroupName : {
Code : "XMinioInvalidGroupName" ,
Description : "The group name is invalid." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
ErrAddUserValidUTF : {
Code : "XMinioInvalidUTF" ,
Description : "Invalid UTF-8 character detected." ,
HTTPStatusCode : http . StatusBadRequest ,
} ,
2015-02-11 06:23:15 -05:00
}
2016-05-05 23:24:29 -04:00
// toAPIErrorCode - Converts embedded errors. Convenience
// function written to handle all cases where we have known types of
// errors returned by underlying layers.
2018-11-12 14:07:43 -05:00
func toAPIErrorCode ( ctx context . Context , err error ) ( apiErr APIErrorCode ) {
2016-05-05 23:24:29 -04:00
if err == nil {
return ErrNone
}
2020-05-11 16:04:11 -04:00
2024-02-09 16:25:16 -05:00
// Errors that are generated by net.Conn and any context errors must be handled here.
if errors . Is ( err , os . ErrDeadlineExceeded ) || errors . Is ( err , context . DeadlineExceeded ) {
return ErrRequestTimedout
}
2020-10-30 12:33:16 -04:00
// Only return ErrClientDisconnected if the provided context is actually canceled.
2023-06-18 21:20:15 -04:00
// This way downstream context.Canceled will still report ErrRequestTimedout
2023-03-07 11:12:41 -05:00
if contextCanceled ( ctx ) && errors . Is ( ctx . Err ( ) , context . Canceled ) {
return ErrClientDisconnected
2020-10-30 12:33:16 -04:00
}
2023-05-25 12:39:06 -04:00
// Unwrap the error first
err = unwrapAll ( err )
2016-07-05 04:04:50 -04:00
switch err {
2018-10-16 15:48:19 -04:00
case errInvalidArgument :
apiErr = ErrAdminInvalidArgument
2023-03-07 11:12:41 -05:00
case errNoSuchPolicy :
apiErr = ErrAdminNoSuchPolicy
2018-10-16 15:48:19 -04:00
case errNoSuchUser :
apiErr = ErrAdminNoSuchUser
2023-05-26 09:31:24 -04:00
case errNoSuchUserLDAPWarn :
apiErr = ErrAdminNoSuchUserLDAPWarn
2021-04-15 01:51:14 -04:00
case errNoSuchServiceAccount :
apiErr = ErrAdminServiceAccountNotFound
2019-08-02 17:25:00 -04:00
case errNoSuchGroup :
apiErr = ErrAdminNoSuchGroup
case errGroupNotEmpty :
apiErr = ErrAdminGroupNotEmpty
2024-05-28 13:14:16 -04:00
case errGroupNameContainsReservedChars :
apiErr = ErrAdminInvalidGroupName
2022-10-03 05:10:15 -04:00
case errNoSuchJob :
apiErr = ErrAdminNoSuchJob
2022-12-09 16:08:33 -05:00
case errNoPolicyToAttachOrDetach :
apiErr = ErrAdminPolicyChangeAlreadyApplied
2016-07-05 04:04:50 -04:00
case errSignatureMismatch :
apiErr = ErrSignatureDoesNotMatch
2018-10-02 15:48:51 -04:00
case errInvalidRange :
apiErr = ErrInvalidRange
2017-01-30 18:44:42 -05:00
case errDataTooLarge :
apiErr = ErrEntityTooLarge
case errDataTooSmall :
apiErr = ErrEntityTooSmall
2019-08-20 23:43:15 -04:00
case errAuthentication :
apiErr = ErrAccessDenied
2024-05-28 13:14:16 -04:00
case auth . ErrContainsReservedChars :
apiErr = ErrAdminInvalidAccessKey
2017-10-31 14:54:32 -04:00
case auth . ErrInvalidAccessKeyLength :
2017-02-07 15:51:43 -05:00
apiErr = ErrAdminInvalidAccessKey
2017-10-31 14:54:32 -04:00
case auth . ErrInvalidSecretKeyLength :
2017-02-07 15:51:43 -05:00
apiErr = ErrAdminInvalidSecretKey
2024-02-13 05:31:43 -05:00
case auth . ErrNoAccessKeyWithSecretKey :
apiErr = ErrAdminNoAccessKey
case auth . ErrNoSecretKeyWithAccessKey :
apiErr = ErrAdminNoSecretKey
2021-05-19 21:51:23 -04:00
case errInvalidStorageClass :
apiErr = ErrInvalidStorageClass
2023-03-07 11:12:41 -05:00
case errErasureReadQuorum :
2023-06-18 21:20:15 -04:00
apiErr = ErrSlowDownRead
2023-03-07 11:12:41 -05:00
case errErasureWriteQuorum :
2023-06-18 21:20:15 -04:00
apiErr = ErrSlowDownWrite
2023-08-04 13:40:21 -04:00
case errMaxVersionsExceeded :
apiErr = ErrMaxVersionsExceeded
2018-02-02 21:18:52 -05:00
// SSE errors
2018-10-16 15:27:34 -04:00
case errInvalidEncryptionParameters :
apiErr = ErrInvalidEncryptionParameters
2023-01-24 18:46:33 -05:00
case errInvalidEncryptionParametersSSEC :
apiErr = ErrInvalidEncryptionParametersSSEC
2018-08-03 19:55:45 -04:00
case crypto . ErrInvalidEncryptionMethod :
apiErr = ErrInvalidEncryptionMethod
2022-08-16 14:28:30 -04:00
case crypto . ErrInvalidEncryptionKeyID :
apiErr = ErrInvalidEncryptionKeyID
2018-08-17 15:52:14 -04:00
case crypto . ErrInvalidCustomerAlgorithm :
2018-02-02 21:18:52 -05:00
apiErr = ErrInvalidSSECustomerAlgorithm
2018-08-17 15:52:14 -04:00
case crypto . ErrMissingCustomerKey :
2018-02-02 21:18:52 -05:00
apiErr = ErrMissingSSECustomerKey
2018-08-17 15:52:14 -04:00
case crypto . ErrMissingCustomerKeyMD5 :
2018-02-02 21:18:52 -05:00
apiErr = ErrMissingSSECustomerKeyMD5
2018-08-17 15:52:14 -04:00
case crypto . ErrCustomerKeyMD5Mismatch :
2018-02-02 21:18:52 -05:00
apiErr = ErrSSECustomerKeyMD5Mismatch
2017-11-07 18:18:59 -05:00
case errObjectTampered :
2018-02-02 21:18:52 -05:00
apiErr = ErrObjectTampered
2017-11-07 18:18:59 -05:00
case errEncryptedObject :
2018-02-02 21:18:52 -05:00
apiErr = ErrSSEEncryptedObject
2018-04-06 17:15:23 -04:00
case errInvalidSSEParameters :
2018-02-02 21:18:52 -05:00
apiErr = ErrInvalidSSECustomerParameters
2018-09-06 15:31:12 -04:00
case crypto . ErrInvalidCustomerKey , crypto . ErrSecretKeyMismatch :
2018-02-02 21:18:52 -05:00
apiErr = ErrAccessDenied // no access without correct key
2018-08-17 15:52:14 -04:00
case crypto . ErrIncompatibleEncryptionMethod :
apiErr = ErrIncompatibleEncryptionMethod
case errKMSNotConfigured :
apiErr = ErrKMSNotConfigured
2022-02-17 14:36:14 -05:00
case errKMSKeyNotFound :
apiErr = ErrKMSKeyNotFoundException
2023-02-21 20:43:01 -05:00
case errKMSDefaultKeyAlreadyConfigured :
apiErr = ErrKMSDefaultKeyAlreadyConfigured
2023-06-18 21:20:15 -04:00
case context . Canceled :
apiErr = ErrClientDisconnected
case context . DeadlineExceeded :
apiErr = ErrRequestTimedout
2020-01-16 18:41:56 -05:00
case objectlock . ErrInvalidRetentionDate :
2019-11-20 16:18:09 -05:00
apiErr = ErrInvalidRetentionDate
2020-01-16 18:41:56 -05:00
case objectlock . ErrPastObjectLockRetainDate :
2019-11-20 16:18:09 -05:00
apiErr = ErrPastObjectLockRetainDate
2020-01-16 18:41:56 -05:00
case objectlock . ErrUnknownWORMModeDirective :
2019-11-20 16:18:09 -05:00
apiErr = ErrUnknownWORMModeDirective
2020-01-16 18:41:56 -05:00
case objectlock . ErrObjectLockInvalidHeaders :
2019-11-20 16:18:09 -05:00
apiErr = ErrObjectLockInvalidHeaders
2020-01-16 18:41:56 -05:00
case objectlock . ErrMalformedXML :
apiErr = ErrMalformedXML
2023-04-19 01:34:30 -04:00
case errInvalidMaxParts :
apiErr = ErrInvalidMaxParts
2023-05-05 22:53:12 -04:00
case ioutil . ErrOverread :
apiErr = ErrExcessData
2024-04-22 13:49:30 -04:00
case errServerNotInitialized :
apiErr = ErrServerNotInitialized
case errBucketMetadataNotInitialized :
apiErr = ErrBucketMetadataNotInitialized
2018-02-02 21:18:52 -05:00
}
2018-09-27 23:36:17 -04:00
// Compression errors
2023-03-06 11:56:10 -05:00
if err == errInvalidDecompressedSize {
2018-09-27 23:36:17 -04:00
apiErr = ErrInvalidDecompressedSize
}
2018-02-02 21:18:52 -05:00
if apiErr != ErrNone {
// If there was a match in the above switch case.
return apiErr
}
// etcd specific errors, a key is always a bucket for us return
// ErrNoSuchBucket in such a case.
2023-03-07 11:12:41 -05:00
if errors . Is ( err , dns . ErrNoEntriesFound ) {
2018-07-12 17:12:40 -04:00
return ErrNoSuchBucket
2017-11-07 18:18:59 -05:00
}
2016-05-05 23:24:29 -04:00
switch err . ( type ) {
case StorageFull :
apiErr = ErrStorageFull
2017-10-22 01:30:34 -04:00
case hash . BadDigest :
2016-05-05 23:24:29 -04:00
apiErr = ErrBadDigest
2017-05-05 21:49:08 -04:00
case AllAccessDisabled :
apiErr = ErrAllAccessDisabled
2016-05-05 23:24:29 -04:00
case IncompleteBody :
apiErr = ErrIncompleteBody
2016-05-08 15:36:16 -04:00
case ObjectExistsAsDirectory :
apiErr = ErrObjectExistsAsDirectory
2016-10-20 19:09:55 -04:00
case PrefixAccessDenied :
apiErr = ErrAccessDenied
2016-05-05 23:24:29 -04:00
case BucketNameInvalid :
apiErr = ErrInvalidBucketName
case BucketNotFound :
apiErr = ErrNoSuchBucket
2017-04-27 14:26:00 -04:00
case BucketAlreadyOwnedByYou :
apiErr = ErrBucketAlreadyOwnedByYou
2016-05-05 23:24:29 -04:00
case BucketNotEmpty :
apiErr = ErrBucketNotEmpty
2017-05-08 17:53:47 -04:00
case BucketAlreadyExists :
apiErr = ErrBucketAlreadyExists
2016-05-05 23:24:29 -04:00
case BucketExists :
apiErr = ErrBucketAlreadyOwnedByYou
case ObjectNotFound :
apiErr = ErrNoSuchKey
2020-06-12 23:04:01 -04:00
case MethodNotAllowed :
apiErr = ErrMethodNotAllowed
2021-10-30 11:22:04 -04:00
case ObjectLocked :
apiErr = ErrObjectLocked
2020-11-29 00:15:45 -05:00
case InvalidVersionID :
apiErr = ErrInvalidVersionID
2020-06-12 23:04:01 -04:00
case VersionNotFound :
apiErr = ErrNoSuchVersion
2018-03-27 19:44:45 -04:00
case ObjectAlreadyExists :
apiErr = ErrMethodNotAllowed
2016-05-05 23:24:29 -04:00
case ObjectNameInvalid :
2016-07-09 20:11:08 -04:00
apiErr = ErrInvalidObjectName
2019-07-12 00:38:12 -04:00
case ObjectNamePrefixAsSlash :
apiErr = ErrInvalidObjectNamePrefixSlash
2016-05-05 23:24:29 -04:00
case InvalidUploadID :
apiErr = ErrNoSuchUpload
case InvalidPart :
apiErr = ErrInvalidPart
case InsufficientWriteQuorum :
2023-06-18 21:20:15 -04:00
apiErr = ErrSlowDownWrite
2016-05-05 23:24:29 -04:00
case InsufficientReadQuorum :
2023-06-18 21:20:15 -04:00
apiErr = ErrSlowDownRead
2016-09-15 04:44:19 -04:00
case InvalidUploadIDKeyCombination :
apiErr = ErrNotImplemented
case MalformedUploadID :
apiErr = ErrNoSuchUpload
2016-05-08 15:06:05 -04:00
case PartTooSmall :
apiErr = ErrEntityTooSmall
2017-05-10 19:52:38 -04:00
case SignatureDoesNotMatch :
apiErr = ErrSignatureDoesNotMatch
2017-10-22 01:30:34 -04:00
case hash . SHA256Mismatch :
2016-10-02 18:51:49 -04:00
apiErr = ErrContentSHA256Mismatch
2022-08-29 19:57:16 -04:00
case hash . ChecksumMismatch :
apiErr = ErrContentChecksumMismatch
2023-05-15 17:08:54 -04:00
case hash . SizeTooSmall :
2016-11-21 07:15:26 -05:00
apiErr = ErrEntityTooSmall
2023-05-15 17:08:54 -04:00
case hash . SizeTooLarge :
apiErr = ErrEntityTooLarge
2017-03-16 15:21:58 -04:00
case NotImplemented :
apiErr = ErrNotImplemented
2017-07-12 19:42:14 -04:00
case PartTooBig :
apiErr = ErrEntityTooLarge
2017-09-12 19:14:41 -04:00
case UnsupportedMetadata :
apiErr = ErrUnsupportedMetadata
2017-10-27 19:14:06 -04:00
case BucketPolicyNotFound :
apiErr = ErrNoSuchBucketPolicy
2019-07-19 16:20:33 -04:00
case BucketLifecycleNotFound :
2020-02-08 06:16:59 -05:00
apiErr = ErrNoSuchLifecycleConfiguration
2020-02-05 04:42:34 -05:00
case BucketSSEConfigNotFound :
apiErr = ErrNoSuchBucketSSEConfig
2020-05-08 16:44:44 -04:00
case BucketTaggingNotFound :
apiErr = ErrBucketTaggingNotFound
case BucketObjectLockConfigNotFound :
apiErr = ErrObjectLockConfigurationNotFound
2020-04-30 18:55:54 -04:00
case BucketQuotaConfigNotFound :
apiErr = ErrAdminNoSuchQuotaConfiguration
2020-07-21 20:49:56 -04:00
case BucketReplicationConfigNotFound :
apiErr = ErrReplicationConfigurationNotFoundError
2020-10-08 13:54:11 -04:00
case BucketRemoteDestinationNotFound :
apiErr = ErrRemoteDestinationNotFoundError
2020-07-30 22:55:22 -04:00
case BucketRemoteTargetNotFound :
2020-10-08 13:54:11 -04:00
apiErr = ErrRemoteTargetNotFoundError
2022-08-16 20:46:22 -04:00
case RemoteTargetConnectionErr :
2020-09-04 11:48:38 -04:00
apiErr = ErrReplicationRemoteConnectionError
2020-07-30 22:55:22 -04:00
case BucketRemoteAlreadyExists :
apiErr = ErrBucketRemoteAlreadyExists
2020-10-08 13:54:11 -04:00
case BucketRemoteLabelInUse :
apiErr = ErrBucketRemoteLabelInUse
2020-07-30 22:55:22 -04:00
case BucketRemoteArnTypeInvalid :
apiErr = ErrBucketRemoteArnTypeInvalid
case BucketRemoteArnInvalid :
apiErr = ErrBucketRemoteArnInvalid
case BucketRemoteRemoveDisallowed :
apiErr = ErrBucketRemoteRemoveDisallowed
2020-10-08 13:54:11 -04:00
case BucketRemoteTargetNotVersioned :
apiErr = ErrRemoteTargetNotVersionedError
2020-08-06 20:10:21 -04:00
case BucketReplicationSourceNotVersioned :
apiErr = ErrReplicationSourceNotVersionedError
2021-04-19 13:30:42 -04:00
case TransitionStorageClassNotFound :
apiErr = ErrTransitionStorageClassNotFoundError
case InvalidObjectState :
apiErr = ErrInvalidObjectState
2023-02-15 10:12:48 -05:00
case PreConditionFailed :
apiErr = ErrPreconditionFailed
2020-04-30 18:55:54 -04:00
case BucketQuotaExceeded :
apiErr = ErrAdminBucketQuotaExceeded
2018-03-15 16:03:41 -04:00
case * event . ErrInvalidEventName :
apiErr = ErrEventNotification
case * event . ErrInvalidARN :
apiErr = ErrARNNotification
case * event . ErrARNNotFound :
apiErr = ErrARNNotification
2023-03-07 11:12:41 -05:00
case * levent . ErrInvalidARN :
apiErr = ErrLambdaARNInvalid
case * levent . ErrARNNotFound :
apiErr = ErrLambdaARNNotFound
2018-03-15 16:03:41 -04:00
case * event . ErrUnknownRegion :
apiErr = ErrRegionNotification
case * event . ErrInvalidFilterName :
apiErr = ErrFilterNameInvalid
case * event . ErrFilterNamePrefix :
apiErr = ErrFilterNamePrefix
case * event . ErrFilterNameSuffix :
apiErr = ErrFilterNameSuffix
case * event . ErrInvalidFilterValue :
apiErr = ErrFilterValueInvalid
case * event . ErrDuplicateEventName :
apiErr = ErrOverlappingConfigs
case * event . ErrDuplicateQueueConfiguration :
apiErr = ErrOverlappingFilterNotification
case * event . ErrUnsupportedConfiguration :
apiErr = ErrUnsupportedNotification
2020-03-11 17:11:04 -04:00
case OperationTimedOut :
2023-06-18 21:20:15 -04:00
apiErr = ErrRequestTimedout
2018-03-28 17:14:06 -04:00
case BackendDown :
apiErr = ErrBackendDown
2019-07-12 00:38:12 -04:00
case ObjectNameTooLong :
apiErr = ErrKeyTooLongError
2020-09-30 17:09:41 -04:00
case dns . ErrInvalidBucketName :
apiErr = ErrInvalidBucketName
2021-04-08 11:24:55 -04:00
case dns . ErrBucketConflict :
apiErr = ErrBucketAlreadyExists
2016-05-05 23:24:29 -04:00
default :
2024-02-12 02:21:56 -05:00
if strings . Contains ( err . Error ( ) , "request declared a Content-Length" ) {
2019-03-07 19:11:28 -05:00
apiErr = ErrIncompleteBody
} else {
apiErr = ErrInternalError
}
2016-05-05 23:24:29 -04:00
}
2016-11-21 16:51:05 -05:00
2016-05-05 23:24:29 -04:00
return apiErr
}
2019-02-12 04:25:52 -05:00
var noError = APIError { }
// toAPIError - Converts embedded errors. Convenience
// function written to handle all cases where we have known types of
// errors returned by underlying layers.
func toAPIError ( ctx context . Context , err error ) APIError {
if err == nil {
return noError
}
2022-01-02 12:15:06 -05:00
apiErr := errorCodes . ToAPIErr ( toAPIErrorCode ( ctx , err ) )
2023-03-07 11:12:41 -05:00
switch apiErr . Code {
case "NotImplemented" :
apiErr = APIError {
Code : apiErr . Code ,
2024-05-05 12:56:21 -04:00
Description : fmt . Sprintf ( "%s (%v)" , apiErr . Description , err ) ,
2023-03-07 11:12:41 -05:00
HTTPStatusCode : apiErr . HTTPStatusCode ,
2021-04-15 19:20:45 -04:00
}
2023-03-07 11:12:41 -05:00
case "XMinioBackendDown" :
2021-11-11 01:33:17 -05:00
apiErr . Description = fmt . Sprintf ( "%s (%v)" , apiErr . Description , err )
2023-03-07 11:12:41 -05:00
case "InternalError" :
2019-02-12 04:25:52 -05:00
// If we see an internal error try to interpret
// any underlying errors if possible depending on
2022-10-24 20:44:15 -04:00
// their internal error types.
2019-02-12 04:25:52 -05:00
switch e := err . ( type ) {
2023-03-16 14:59:42 -04:00
case kms . Error :
apiErr = APIError {
Code : e . APICode ,
2024-05-07 19:55:37 -04:00
Description : e . Err ,
HTTPStatusCode : e . Code ,
2023-03-16 14:59:42 -04:00
}
2022-10-15 14:58:31 -04:00
case batchReplicationJobError :
2024-05-05 12:56:21 -04:00
apiErr = APIError {
Description : e . Description ,
Code : e . Code ,
HTTPStatusCode : e . HTTPStatusCode ,
}
case InvalidRange :
apiErr = APIError {
Code : "InvalidRange" ,
Description : e . Error ( ) ,
HTTPStatusCode : errorCodes [ ErrInvalidRange ] . HTTPStatusCode ,
ObjectSize : strconv . FormatInt ( e . ResourceSize , 10 ) ,
RangeRequested : fmt . Sprintf ( "%d-%d" , e . OffsetBegin , e . OffsetEnd ) ,
}
2020-07-08 20:36:56 -04:00
case InvalidArgument :
apiErr = APIError {
Code : "InvalidArgument" ,
Description : e . Error ( ) ,
HTTPStatusCode : errorCodes [ ErrInvalidRequest ] . HTTPStatusCode ,
}
2020-02-16 01:07:52 -05:00
case * xml . SyntaxError :
apiErr = APIError {
2023-03-07 11:12:41 -05:00
Code : "MalformedXML" ,
Description : fmt . Sprintf ( "%s (%s)" , errorCodes [ ErrMalformedXML ] . Description , e ) ,
2020-02-16 01:07:52 -05:00
HTTPStatusCode : errorCodes [ ErrMalformedXML ] . HTTPStatusCode ,
}
2020-02-11 22:38:02 -05:00
case url . EscapeError :
apiErr = APIError {
2023-03-07 11:12:41 -05:00
Code : "XMinioInvalidObjectName" ,
Description : fmt . Sprintf ( "%s (%s)" , errorCodes [ ErrInvalidObjectName ] . Description , e ) ,
2020-02-11 22:38:02 -05:00
HTTPStatusCode : http . StatusBadRequest ,
}
2020-06-12 23:04:01 -04:00
case versioning . Error :
apiErr = APIError {
Code : "IllegalVersioningConfigurationException" ,
2023-03-07 11:12:41 -05:00
Description : fmt . Sprintf ( "Versioning configuration specified in the request is invalid. (%s)" , e ) ,
2020-06-12 23:04:01 -04:00
HTTPStatusCode : http . StatusBadRequest ,
}
2020-02-06 02:50:10 -05:00
case lifecycle . Error :
apiErr = APIError {
2023-06-13 16:52:33 -04:00
Code : "InvalidArgument" ,
2020-02-06 02:50:10 -05:00
Description : e . Error ( ) ,
HTTPStatusCode : http . StatusBadRequest ,
}
2020-07-21 20:49:56 -04:00
case replication . Error :
apiErr = APIError {
Code : "MalformedXML" ,
Description : e . Error ( ) ,
HTTPStatusCode : http . StatusBadRequest ,
}
2020-05-05 17:18:13 -04:00
case tags . Error :
2020-01-20 11:45:59 -05:00
apiErr = APIError {
2020-02-11 20:42:28 -05:00
Code : e . Code ( ) ,
2020-01-20 11:45:59 -05:00
Description : e . Error ( ) ,
HTTPStatusCode : http . StatusBadRequest ,
}
2020-01-03 14:28:52 -05:00
case policy . Error :
apiErr = APIError {
Code : "MalformedPolicy" ,
Description : e . Error ( ) ,
HTTPStatusCode : http . StatusBadRequest ,
}
2019-09-22 04:12:51 -04:00
case crypto . Error :
apiErr = APIError {
2022-06-20 13:48:11 -04:00
Code : "XMinioEncryptionError" ,
2019-09-22 04:12:51 -04:00
Description : e . Error ( ) ,
HTTPStatusCode : http . StatusBadRequest ,
}
2019-02-12 04:25:52 -05:00
case minio . ErrorResponse :
apiErr = APIError {
Code : e . Code ,
Description : e . Message ,
HTTPStatusCode : e . StatusCode ,
}
2022-10-24 20:44:15 -04:00
if strings . Contains ( e . Message , "KMS is not configured" ) {
2021-04-08 19:40:38 -04:00
apiErr = APIError {
Code : "NotImplemented" ,
Description : e . Message ,
HTTPStatusCode : http . StatusNotImplemented ,
}
}
2019-02-12 04:25:52 -05:00
case * googleapi . Error :
apiErr = APIError {
Code : "XGCSInternalError" ,
Description : e . Message ,
HTTPStatusCode : e . Code ,
}
// GCS may send multiple errors, just pick the first one
// since S3 only sends one Error XML response.
if len ( e . Errors ) >= 1 {
apiErr . Code = e . Errors [ 0 ] . Reason
}
2024-08-13 14:21:34 -04:00
case * azcore . ResponseError :
2019-02-12 04:25:52 -05:00
apiErr = APIError {
2024-08-13 14:21:34 -04:00
Code : e . ErrorCode ,
2019-12-02 12:32:19 -05:00
Description : e . Error ( ) ,
2024-08-13 14:21:34 -04:00
HTTPStatusCode : e . StatusCode ,
2019-02-12 04:25:52 -05:00
}
2022-10-24 20:44:15 -04:00
// Add more other SDK related errors here if any in future.
2021-01-25 13:15:03 -05:00
default :
2021-11-16 12:28:29 -05:00
//nolint:gocritic
2023-03-07 11:12:41 -05:00
if errors . Is ( err , errMalformedEncoding ) || errors . Is ( err , errChunkTooBig ) || errors . Is ( err , strconv . ErrRange ) {
2021-09-09 17:37:07 -04:00
apiErr = APIError {
Code : "BadRequest" ,
Description : err . Error ( ) ,
HTTPStatusCode : http . StatusBadRequest ,
}
} else {
apiErr = APIError {
Code : apiErr . Code ,
Description : fmt . Sprintf ( "%s: cause(%v)" , apiErr . Description , err ) ,
HTTPStatusCode : apiErr . HTTPStatusCode ,
}
2021-01-25 13:15:03 -05:00
}
2019-02-12 04:25:52 -05:00
}
}
2024-02-11 17:21:08 -05:00
if apiErr . Code == "InternalError" {
// Make sure to log the errors which we cannot translate
// to a meaningful S3 API errors. This is added to aid in
// debugging unexpected/unhandled errors.
2024-04-04 08:04:40 -04:00
internalLogIf ( ctx , err )
2024-02-11 17:21:08 -05:00
}
2019-02-12 04:25:52 -05:00
return apiErr
}
2016-03-10 05:24:52 -05:00
// getAPIError provides API Error for input API error code.
func getAPIError ( code APIErrorCode ) APIError {
2019-02-12 04:25:52 -05:00
if apiErr , ok := errorCodes [ code ] ; ok {
2018-09-18 19:46:35 -04:00
return apiErr
}
2019-02-12 04:25:52 -05:00
return errorCodes . ToAPIErr ( ErrInternalError )
2015-02-11 06:23:15 -05:00
}
2024-08-13 14:23:33 -04:00
// getAPIErrorResponse gets in standard error and resource value and
2015-02-23 19:46:48 -05:00
// provides a encodable populated response values
2019-02-13 19:07:21 -05:00
func getAPIErrorResponse ( ctx context . Context , err APIError , resource , requestID , hostID string ) APIErrorResponse {
reqInfo := logger . GetReqInfo ( ctx )
2017-01-18 15:24:34 -05:00
return APIErrorResponse {
2024-05-05 12:56:21 -04:00
Code : err . Code ,
Message : err . Description ,
BucketName : reqInfo . BucketName ,
Key : reqInfo . ObjectName ,
Resource : resource ,
2024-05-16 19:13:47 -04:00
Region : globalSite . Region ( ) ,
2024-05-05 12:56:21 -04:00
RequestID : requestID ,
HostID : hostID ,
ActualObjectSize : err . ObjectSize ,
RangeRequested : err . RangeRequested ,
2015-02-12 01:00:45 -05:00
}
2015-02-11 06:23:15 -05:00
}