Fix for WSL2 docker-credential-desktop.exe: Invalid argument

I just ran into a weird error with WSL after moving a workspace around on a different machine and trying to run ddev.

failed to solve with frontend dockerfile.v0: failed to build LLB: failed to load cache key: rpc error: code = Unknown desc = error getting credentials - err: exec: “docker-credential-desktop.exe”: executable file not found in $PATH, out: ``

When trying to invoke the “docker-credential-desktop.exe” from WSL (by building a Docker image or trying to run ddev for example) I always got a “Invalid argument” error. After a bit of trying around I found this message on the Docker forums which actually fixed the problem for me.

Edit the ~/.docker/config.json file:

nano ~/.docker/config.json

It should display something similar to this:

{
  "credsStore": "desktop.exe"
}

Change “credsStore” to “credStore” like this:

{
  "credStore": "desktop.exe"
}

I have no idea why this works or why this is a thing, but I would like to preserve this solution here in case it happens to me again or somebody else runs into this same problem.

I was able to run ddev normally afterwards.