{"record":{"id":"cc493936d68d5c7e","repo":"sipeed/picoclaw","slug":"decode-aes-key-w","errorCode":null,"errorMessage":"decode AES key: %w","messagePattern":"decode AES key: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/channels/wecom/media.go","lineNumber":96,"sourceCode":"\t\t\tMediaID:     m.MediaID,\n\t\t\tTitle:       m.Title,\n\t\t\tDescription: m.Description,\n\t\t}\n\t}\n\treturn body\n}\n\nfunc decodeMediaAESKey(value string) ([]byte, error) {\n\tif value == \"\" {\n\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}","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/channels/wecom/media.go#L78-L114","documentation":"Error \"decode AES key: %w\" thrown in sipeed/picoclaw.","triggerScenarios":"Thrown at pkg/channels/wecom/media.go:96 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"}