topological_sort: Fixing error reporting when there are two packages with the same name

This was failing in non-homogenous workspaces.