## Main

We use the experimental system introduced in refs 10,22, which consists of colloidal rollers powered by the so-called Quincke electro-rotation mechanism23 (see Methods and Supplementary Methods). The motile colloids experience both hydrodynamic and electrostatic interactions which promote alignment of their translational velocity10,22. When the roller packing fraction, ρ, exceeds 3 × 10−3, these polar interactions overcome rotational diffusion and macroscopic collective motion emerges10,22. In the homogeneous slab geometry shown in Fig. 1a, a seven-millimetre-long flock spontaneously forms and cruises through a dilute ensemble of rollers moving isotropically (see Supplementary Movie 1). The flock has a sharp front, a long tail, and endlessly cruises at a constant speed along the x-axis, bouncing back and forth on the confining walls. The flock speed cF is found to be equal to the speed of an isolated roller v0 = 1.4 ± 0.1 mm s−1.

Can flocks propagate in disorder media? How does this broken-symmetry phase survive to geometrical disorder? To answer these questions, we include randomly distributed circular obstacles of radius a = 5 μm in the microfluidic channel. When the obstacle packing fraction φo is small, collective motion still emerges according to the same nucleation and propagation scenario (see Fig. 1b and Supplementary Movie 2). However, as φo exceeds a critical value, φo, the obstacle collisions suppress any form of global orientational order and macroscopic transport. Correlated motion persists only at short scales, as illustrated in Supplementary Movie 3. As expected, dense flocks are more robust to disorder and φo increases monotonically with the roller fraction ρ (Fig. 1c).

In all that follows, the sole control parameter of our experiments is the obstacle fraction φo. The roller fraction is set to a constant value above the flocking threshold in a obstacle-free channel, ρ = (1.02 ± 0.06) × 10−2. A natural order parameter for the flocking transition is the magnitude Jx of the roller current J(r, t) projected on the x-axis, and averaged over time and space. Accordingly Jx monotonically decreases with φo and vanishes at φo (Fig. 1d).

Our first goal is to elucidate this loss of orientational order. To do so, we consider the evolution of the flock morphology along the propagation direction upon increasing disorder. This morphology can be equivalently captured by the variations of the local density, current, or polarization fields, as demonstrated in the Supplementary Information. For sake of clarity we focus here on the roller current as the main observable. The flock speed cF is unaltered by disorder and remains very close to the roller velocity for all φo < φo (Fig. 2a). Therefore, the time variations of , the longitudinal current averaged over the transverse direction, give an accurate description of the coarse-grained shape of the flocks (Fig. 2b). Three important results are in order: the decrease of the flock length, LF, echoes that of the global order parameter and vanishes rather smoothly at φo (Fig. 2c). However, as shown in Fig. 2d, the maximal current amplitude, AF, undergoes a sharp drop and cancels discontinuously at φo. Finally, at φo, the flocks are intermittent: they repeatedly form and propagate steadily, before spontaneously vanishing and nucleating again. A featureless isotropic state coexists in time with a phase-separated flocking state where macroscopic excitations as large as 1 mm propagate in the channel. Altogether these three observations yield firm evidence that disorder suppresses the flocking state in the form of a first-order non-equilibrium transition.

However, the obstacles do not merely reduce the extent of the flocks down to their extinction, but also trigger qualitative changes in their inner structure. The snapshots of the roller current J(r, t) at four subsequent times in Fig. 3a demonstrate that the flocks are strongly heterogeneous spatial patterns (see also Supplementary Movie 4). We characterize the local flock morphology by introducing the current field Jflock(r) = ${〈J\left(r,t\right)〉}_{t\in \text{Δ}{t}_{\text{F}}}$ averaged over the time interval ΔtF taken by the flock to cross the observation window. At low φo, we observe that colloid-depleted wakes as large as 50 μm form downstream of each obstacle (see Fig. 3b, upper panel). However, as φo increases, the competition between alignment interactions and multiple-obstacle scattering causes the redistribution of the roller current into a static river network (Fig. 3b). Virtually no collective motion occurs in the closed regions surrounded by the flowing rivers (black regions in Fig. 3b). The extent of the regions where the flow is suppressed can significantly exceed both the typical inter-obstacle distance and the depletion-wake size. Importantly, upon increasing φo, the river network becomes increasingly sparse and different from the region of space left around the mere superposition of uncorrelated wakes. Comparing the areas of these two very different geometries allows us to quantify the sparsity of the river networks in Fig. 3c. In addition, the networks also become increasingly tortuous, as demonstrated by the rapid increase of the orientational fluctuations of Jflock with φo in Fig. 3d. Above φo, orientational order survives to disorder in finite and short-lived rivers. Any form of macroscopic transport is suppressed, as these transient channels are isotropically distributed and do not percolate through the entire system (see Supplementary Movie 3 and the Supplementary Information). We close this discussion by stressing that these emergent river networks are strikingly similar to those encountered above the plastic depinning threshold when driving an ensemble of elastically coupled particles through quenched disorder (from vortex lattices in type-II superconductors, to driven colloids and grains)21,24,25,26,27,28,29,30,31.

To elucidate the physics underlying the suppression of collective motion and the emergence of channelling networks, we first need a quantitative description of the roller–obstacle interactions. As a roller approaches an obstacle its direction of motion is repelled at a distance, yet its speed remains unchanged (Fig. 4a, b). The roller–obstacle and roller–roller repulsions stem from the same physical mechanisms10: a dielectric obstacle causes a local radial perturbation of the electric field used to power the Quincke rotation. As a result, a short-range repulsive torque reorients the roller velocity in the direction opposite to the obstacle (see Supplementary Information). This interaction has the same symmetry as that numerically considered in refs 15,32. The scattering plots, shown in Fig. 4c and Supplementary Information, demonstrate that the repulsive torques are weak and short ranged. A head-on collision merely deflects the initial roller orientation by an angle of 60°. As a consequence, up to φo = 0.1, the trajectories in the isotropic phase remain diffusive at long times, and are fully characterized by their rotational diffusivity D, which increases linearly with φo (Fig. 4d).

We can now account for the first-order nature of the flocking transition. The linear increase of D suggests simplifying the interactions between the rollers and the obstacles as uncorrelated binary collisions with random scatterers32. Within this Boltzmann approximation, we can generalize the kinetic theory valid at the onset of collective motion, which we introduced in ref. 10. We show in the Supplementary Information that the roller–obstacle and roller–roller interactions decouple. Increasing the obstacle fraction solely renormalizes the angular noise acting on the rollers, even when they interact in the flock phase. We then readily conclude that the transition to collective motion should belong to the very same universality class as the first-order flocking transition found in all motile-spin models, starting from the seminal Vicsek model33,34,35. We quantitatively test the relevance of this scenario by comparing, in Fig. 2c, the measured flock length to our theoretical prediction for the shape of such nonlinear excitations as detailed in the Supplementary Information. The unambiguous agreement confirms our theoretical explanation: weak quenched disorder triggers a generic Vicsek-like discontinuous transition from collective to isotropic motion.

However, this appealing scenario cannot capture the emergence of channelling networks at high obstacle fractions. We now theoretically account for these spatial fluctuations by describing the strongly polarized region close to the flock front in the high-φo regime. Therefore, rather than describing the obstacles as point-wise scatterers, we here consider small spatial fluctuations around a homogeneous obstacle-density field. The resulting hydrodynamic equations, derived in the Supplementary Information, are analogous to the Navier–Stokes equations for a polar active fluid:

where we introduce the local polarization Π(r, t) ≡ J(r, t)/[v0ρ(r, t)], and . The convective term on the left-hand side of equation (2) stems from self-propulsion, βρ is a pressure term due to the repulsive interactions between the rollers, and α2 and γ are the elastic constants of this polar liquid ( is an anisotropic second-order operator). Finally, disorder is captured by the quenched force field Fo(r) = −β0 φo(r) which localizes the rollers in the valleys of an effective potential given by the local obstacle-density field φo(r). The linear response of provides a physical insight into the formation of sparse flowing channels. Within this approximation, the orientational fluctuations are readily computed from equations (1) and (2):

where stands for average over disorder, and q is a quasi-longitudinal wave vector (see Supplementary Information). Equation (3) establishes that the polarization fluctuations are set by the competition between random stirring, self-propulsion and bending elasticity. Importantly, orientational fluctuations increase at all scales with the number of obstacles. However, the bending stiffness (α2γ) suppresses the small wavelength fluctuations required to explore the valleys of φo(r), which become increasingly branched and curved as the number of obstacles increases. This competition therefore selects a small subset of all the possible paths and consistently accounts for the formation of sparse and tortuous river networks upon increasing disorder. This scenario is further confirmed by experiments performed in periodic lattices of obstacles. By construction, these arrangements display minute density fluctuations. Therefore, the random stirring force in equation (2) is expected to be vanishingly small compared to an equally dense disordered medium. In agreement with our prediction, we find that no river network emerges in periodic lattices (see Supplementary Fig. 7 and Supplementary Movie 5). This scenario is expected to hold qualitatively beyond linear response. In addition, as it does not depend on the specifics of the colloidal rollers, it must be relevant to any flock made of motile bodies obstructed by repelling obstacles, from living-creature groups to swarming robots to soft-active materials.

## Methods

We use fluorescent polystyrene colloids of diameter 4.8 μm dispersed in a 0.15 mol l−1 AOT-hexadecane solution (Thermo Scientific G0500). The suspension is injected in a wide microfluidic chamber made of two parallel glass slides coated by a conducting layer of indium tin oxide (ITO) (Solems, ITOSOL30, thickness: 80 nm)10. The two electrodes are assembled with double-sided Scotch tape of homogeneous thickness (110 μm). The colloids are confined in a 1 mm × 15 mm channel, by walls made of a positive photoresist resin (Microposit S1818, thickness: 2 μm). Identical cylindrical obstacles of radius 5 μm made of the same material are included in the main channel. Their position is uniformly distributed with a density ρo, and the obstacle fraction is defined as φo = πa2ρo in the main text. Note that some of the obstacles overlap. This geometry is achieved by means of conventional ultraviolet lithography. More details about the design of the microfluidic device are provided in the Supplementary Methods.

The Quincke electro-rotation of the colloids is controlled by applying a homogeneous electric field transverse to the two electrodes . The field is applied with a voltage amplifier (TREK 609E-6). All the reported results correspond to an electric field E0 = 2EQ, where EQ is the Quincke electro-rotation threshold EQ = 1 V μm−1. All the measurements are performed when a steady state is reached for all the observables. The colloids are observed with a 7.2× magnification with a fluorescent Nikon AZ100 microscope. The movies are recorded with a CMOS camera (Basler ACE) at frame rates of 380 fps. The particles are detected to sub-pixel accuracy, and the particle trajectories and velocities are reconstructed using the Crocker and Grier algorithm37. Measurements are performed in a 1.22 mm × 0.75 mm observation window. All measurements have been systematically repeated for 15 to 18 different flocks crossing the same field of view (different initial conditions). In addition we have used four different realizations of the disordered arrangements of obstacles. The observation window was set close to the midpoint of the main channel where all the morphological quantities have reached their stationary values. Measurements performed further away from the walls yield identical results.

All the colloids roll at constant speed v0 = 1.4 ± 0.1 mm s−1. When isolated, their direction of motion freely diffuses on the unit circle with a diffusivity D = 1.6 ± 0.1 s−1. D is defined as the exponential decorrelation rate of the velocity orientation in a isotropic phase, , where is the velocity orientation of the ith roller.

The current field J(r, t) is computed by summing the instantaneous roller velocities in 12.5 μm × 12.5 μm binning windows. The flock current Jflock(r) is computed by averaging J(r, t) over time. The flowing-path network is defined as the ensemble of points where Jflock exceeds 11 μm s−1. This value has been chosen as the typical average current in the wake left behind an isolated obstacle. None of the results discussed in this letter qualitatively depend on this specific threshold value. The current-free regions referred to in the main text are associated with local current values smaller than this threshold (black areas in Fig. 3b).

### Data availability.

The data that support the plots within this paper and other findings of this study are available from the corresponding author upon request.