{"record":{"id":"2fc81af9947f5f3d","repo":"getsops/sops","slug":"failed-to-decrypt-sops-data-key-with-aws-kms-w","errorCode":null,"errorMessage":"failed to decrypt sops data key with AWS KMS: %w","messagePattern":"failed to decrypt sops data key with AWS KMS: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kms/keysource.go","lineNumber":339,"sourceCode":"\tif err != nil {\n\t\tlog.WithField(\"arn\", key.Arn).Info(\"Decryption failed\")\n\t\treturn nil, fmt.Errorf(\"error base64-decoding encrypted data key: %s\", err)\n\t}\n\tcfg, err := key.createKMSConfig(ctx)\n\tif err != nil {\n\t\tlog.WithField(\"arn\", key.Arn).Info(\"Decryption failed\")\n\t\treturn nil, err\n\t}\n\tclient := key.createClient(cfg)\n\tinput := &kms.DecryptInput{\n\t\tKeyId:             &key.Arn,\n\t\tCiphertextBlob:    k,\n\t\tEncryptionContext: stringPointerToStringMap(key.EncryptionContext),\n\t}\n\tdecrypted, err := client.Decrypt(ctx, input)\n\tif err != nil {\n\t\tlog.WithField(\"arn\", key.Arn).Info(\"Decryption failed\")\n\t\treturn nil, fmt.Errorf(\"failed to decrypt sops data key with AWS KMS: %w\", err)\n\t}\n\tlog.WithField(\"arn\", key.Arn).Info(\"Decryption succeeded\")\n\treturn decrypted.Plaintext, nil\n}\n\n// NeedsRotation returns whether the data key needs to be rotated or not.\nfunc (key *MasterKey) NeedsRotation() bool {\n\treturn time.Since(key.CreationDate) > kmsTTL\n}\n\n// ToString converts the key to a string representation.\nfunc (key *MasterKey) ToString() string {\n\tarnRole := key.Arn\n\tif key.Role != \"\" {\n\t\tarnRole = fmt.Sprintf(\"%s+%s\", key.Arn, key.Role)\n\t}\n\tcontext := kmsContextToString(key.EncryptionContext)\n\tif key.AwsProfile != \"\" {","sourceCodeStart":321,"sourceCodeEnd":357,"githubUrl":"https://github.com/getsops/sops/blob/13442bb98183887d7a9ac09ec8ab0564673a59d8/kms/keysource.go#L321-L357","documentation":"Error \"failed to decrypt sops data key with AWS KMS: %w\" thrown in getsops/sops.","triggerScenarios":"Thrown at kms/keysource.go:339 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"13442bb98183887d7a9ac09ec8ab0564673a59d8","analyzedAt":"2026-09-01T03:53:00.447Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}