{"record":{"id":"4e5a367acd3a63c2","repo":"JuliusBrussee/caveman","slug":"kms-plaintext-is-empty","errorCode":null,"errorMessage":"kms: plaintext is empty","messagePattern":"kms: plaintext is empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"shared/platform/kms/kms.go","lineNumber":177,"sourceCode":"\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.Encrypt(ctx, plaintext)\n}\n\n// EncryptPayload wraps an artifact data key with the dedicated payload KEK.\nfunc EncryptPayload(ctx context.Context, plaintext []byte) ([]byte, error) {\n\tclient, err := FromPayloadEnvironment()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn client.Encrypt(ctx, plaintext)\n}\n\n// Encrypt delegates encryption to key manager.\nfunc (c *Client) Encrypt(ctx context.Context, plaintext []byte) ([]byte, error) {\n\tif len(plaintext) == 0 {\n\t\treturn nil, errors.New(\"kms: plaintext is empty\")\n\t}\n\tif len(plaintext) > maxPlaintextBytes {\n\t\treturn nil, fmt.Errorf(\"kms: plaintext exceeds %d bytes\", maxPlaintextBytes)\n\t}\n\tvar response struct {\n\t\tKeyID      string `json:\"key_id\"`\n\t\tCiphertext string `json:\"ciphertext\"`\n\t}\n\tif err := c.call(ctx, c.region, c.keyID, \"encrypt\", map[string]string{\n\t\t\"plaintext\": base64.StdEncoding.EncodeToString(plaintext),\n\t}, &response); err != nil {\n\t\treturn nil, err\n\t}\n\tif response.KeyID != c.keyID || strings.TrimSpace(response.Ciphertext) == \"\" {\n\t\treturn nil, errors.New(\"kms: invalid encrypt response\")\n\t}\n\tenvelope, err := json.Marshal(Envelope{Provider: c.provider, Region: c.region, KeyID: response.KeyID, Ciphertext: response.Ciphertext})\n\tif err != nil {","sourceCodeStart":159,"sourceCodeEnd":195,"githubUrl":"https://github.com/JuliusBrussee/caveman/blob/27d5a3981a347890211bb1bf2439e5c821a63bc9/shared/platform/kms/kms.go#L159-L195","documentation":"Error \"kms: plaintext is empty\" thrown in JuliusBrussee/caveman.","triggerScenarios":"Thrown at shared/platform/kms/kms.go:177 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide non-empty plaintext to encrypt."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"27d5a3981a347890211bb1bf2439e5c821a63bc9","analyzedAt":"2026-08-15T09:26:11.751Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}