Redis Challenge #FY6. Failing with "expected simple string"

I’m stuck on Redis challenge, #FY6

The specification mentioned that the response of EXEC command is an array of responses of all commands in the transaction. But my test cases are failing with an error message “expected Simple string, found bulk string”

Here are my logs:

[tester::#FY6] Running tests for Stage #FY6 (Transactions - Executing a transaction)
[tester::#FY6] $ ./your_program.sh
[your_program] Server is ready to accept connections 
[your_program] Client Connected: 127.0.0.1
[tester::#FY6] [client-1] Connected (port 33522 -> port 6379)
[tester::#FY6] [client-2] Connected (port 33538 -> port 6379)
[tester::#FY6] [client-1] $ redis-cli MULTI
[tester::#FY6] [client-1] Sent bytes: "*1\r\n$5\r\nMULTI\r\n"
[your_program] Client Connected: 127.0.0.1
[tester::#FY6] [client-1] Received bytes: "+OK\r\n"
[tester::#FY6] [client-1] Received RESP simple string: "OK"
[tester::#FY6] [client-1] ✔︎ Received "OK"
[tester::#FY6] Sending command: 1/4
[tester::#FY6] [client-1] > SET grape 16
[tester::#FY6] [client-1] Sent bytes: "*3\r\n$3\r\nSET\r\n$5\r\ngrape\r\n$2\r\n16\r\n"
[tester::#FY6] [client-1] Received bytes: "+QUEUED\r\n"
[tester::#FY6] [client-1] Received RESP simple string: "QUEUED"
[tester::#FY6] [client-1] ✔︎ Received "QUEUED"
[tester::#FY6] Sending command: 2/4
[tester::#FY6] [client-1] > INCR grape
[tester::#FY6] [client-1] Sent bytes: "*2\r\n$4\r\nINCR\r\n$5\r\ngrape\r\n"
[tester::#FY6] [client-1] Received bytes: "+QUEUED\r\n"
[tester::#FY6] [client-1] Received RESP simple string: "QUEUED"
[tester::#FY6] [client-1] ✔︎ Received "QUEUED"
[tester::#FY6] Sending command: 3/4
[tester::#FY6] [client-1] > INCR strawberry
[tester::#FY6] [client-1] Sent bytes: "*2\r\n$4\r\nINCR\r\n$10\r\nstrawberry\r\n"
[tester::#FY6] [client-1] Received bytes: "+QUEUED\r\n"
[tester::#FY6] [client-1] Received RESP simple string: "QUEUED"
[tester::#FY6] [client-1] ✔︎ Received "QUEUED"
[tester::#FY6] Sending command: 4/4
[tester::#FY6] [client-1] > GET strawberry
[tester::#FY6] [client-1] Sent bytes: "*2\r\n$3\r\nGET\r\n$10\r\nstrawberry\r\n"
[tester::#FY6] [client-1] Received bytes: "+QUEUED\r\n"
[tester::#FY6] [client-1] Received RESP simple string: "QUEUED"
[tester::#FY6] [client-1] ✔︎ Received "QUEUED"
[tester::#FY6] [client-1] > EXEC
[tester::#FY6] [client-1] Sent bytes: "*1\r\n$4\r\nEXEC\r\n"
[tester::#FY6] [client-1] Received bytes: "*4\r\n$5\r\n+OK\r\n\r\n$5\r\n:17\r\n\r\n$4\r\n:1\r\n\r\n$7\r\n$1\r\n1\r\n\r\n"
[tester::#FY6] [client-1] Received RESP array: [
[tester::#FY6] [client-1]   "+OK\r\n",
[tester::#FY6] [client-1]   ":17\r\n",
[tester::#FY6] [client-1]   ":1\r\n",
[tester::#FY6] [client-1]   "$1\r\n1\r\n"
[tester::#FY6] [client-1] ]
[tester::#FY6] Expected simple string, found bulk string
[tester::#FY6] Test failed
[tester::#FY6] Terminating program
[tester::#FY6] Program terminated successfully

the 4th command is GET strawberry and it returns “1” as a bulk string. I couldn’t figure out why this test fails.

Hey @var-nan, could you upload your code to GitHub and share the link? It will be much easier to debug if I can run it directly.

Hi @andy1li , sure. Github link. Thanks for your time.

There might be multiple issues at play, but the first thing I noticed is that you don’t need to re-encode the cmd_results, since each command’s response is already RESP-encoded.

Let me know if you’d like any further clarification!

Thanks for your help. It worked.