sort dependency candidates by length of name
log error when calculating shard id failed
add more details in log message
correctly handle empty matching group