better error reporting for get_prefixes