{"record":{"id":"840ca2b31abfb650","repo":"sipeed/picoclaw","slug":"ciphertext-is-empty","errorCode":null,"errorMessage":"ciphertext is empty","messagePattern":"ciphertext is empty","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/wecom/media.go","lineNumber":106,"sourceCode":"\t\treturn nil, nil\n\t}\n\tkey, err := base64.StdEncoding.DecodeString(value)\n\tif err == nil && len(key) == 32 {\n\t\treturn key, nil\n\t}\n\tkey, err = base64.StdEncoding.DecodeString(value + \"=\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"decode AES key: %w\", err)\n\t}\n\tif len(key) != 32 {\n\t\treturn nil, fmt.Errorf(\"invalid AES key length %d\", len(key))\n\t}\n\treturn key, nil\n}\n\nfunc decryptAESCBC(key, ciphertext []byte) ([]byte, error) {\n\tif len(ciphertext) == 0 {\n\t\treturn nil, fmt.Errorf(\"ciphertext is empty\")\n\t}\n\tif len(ciphertext)%aes.BlockSize != 0 {\n\t\treturn nil, fmt.Errorf(\"ciphertext length %d is not a multiple of block size\", len(ciphertext))\n\t}\n\tblock, err := aes.NewCipher(key)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"create cipher: %w\", err)\n\t}\n\tplaintext := make([]byte, len(ciphertext))\n\tiv := key[:aes.BlockSize]\n\tcipher.NewCBCDecrypter(block, iv).CryptBlocks(plaintext, ciphertext)\n\treturn pkcs7Unpad(plaintext)\n}\n\nfunc pkcs7Unpad(data []byte) ([]byte, error) {\n\tif len(data) == 0 {\n\t\treturn nil, fmt.Errorf(\"empty plaintext\")\n\t}","sourceCodeStart":88,"sourceCodeEnd":124,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/wecom/media.go#L88-L124","documentation":"Error \"ciphertext is empty\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/channels/wecom/media.go:106 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":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}