500 error trying to get submodule from blob API

I'm trying to get a submodule commit via the Raw file content API

Assuming that lib/libfoo is a submodule (mode 160000), this request gives me a 500 error:

curl --header "PRIVATE-token: secretsecret" https://gitlab.example.com/api/v3/projects/123/repository/blobs/master?filepath=lib/libfoo

In /var/log/gitlab/gitlab-workhorse/current I'm seeing the following error (timestamps removed for clarity):

SendBlob: sending "deadbeef12345678"  for "/api/v3/projects/123/repository/blobs/master"
fatal: git cat-file: could not get object info
error: GET "/api/v3/projects/123/repository/blobs/master?filepath=lib/libfoo": SendBlob: get blob size: exit status 128
"GET /api/v3/projects/123/repository/blobs/master?filepath=lib/libfoo" 500 22 "" "curl/7.38.0" 0.025730