If add a replica set as a member of a shard, with a space between the comma and one of the hosts, like so:
db.runCommand(
{ addshard : 'shard0/localhost:4000, localhost:4001', name: 'shard0' })
I get a misleading error:
"can't use localhost as a shard since all shards need to communicate. either use all shards and configdbs in localhost or all in actual IPs host: localhost:4001 isLocalHost:0"
Better to trim spaces in lists of replica-set members, or to give a more informative error.