Unable to shard collection - won't use specified index

I’m getting a failure when trying to shard a large collection.

I’ve created a hashed index to shard from:

db.records.createIndex({url: "hashed"}, {background: true})
// wait a day or so
sh.shardCollection("dbName.records", {url: "hashed"})

Which returns json:

{
    "ok" : 0.0,
    "errmsg" : "couldn't find valid index for shard key",
    "code" : 96,
    "codeName" : "OperationFailed",
    "operationTime" : Timestamp(1586536087, 10612),
    "$clusterTime" : {
        "clusterTime" : Timestamp(1586536087, 10735),
        "signature" : {
            "hash" : { "$binary" : "tT7Hx3/Zza2xyAPc2x3n08YrKLU=", "$type" : "00" },
            "keyId" : NumberLong(6798667079034601645)
        }
    }
}

The only caveat I can think of is that there is a second index in existence, which covers the same field:

{url: 1}

Is this a known issue? Is there any other reason sharding would fail when the index is already in existence?

I ran into this same issue on a development environment, but recreating the index a few times eventually solved it.

I have this same issue - I get the “couldn’t find valid index for shard key” error when I try to shard a certain collection, even though the hashed index I am trying to shard on definitely exists.

I have created a JIRA issue: https://jira.mongodb.org/browse/SERVER-48471?filter=-2 but so far no response.

Anyone from mongo watching this forum, would be great to get a response.