[IMP] Properly handle errors in build_url