A machine for filling cartridges (C) for aerosol-generating devices, wherein: each cartridge (C) comprises an end (E) with an open area (A) where access to the inside of the cartridge (C) is allowed and an at least partially occluded area (O) where access to the inside of the cartridge (C) is prevented, the cartridge (C) having an axis (H) of longitudinal development that passes through said end (E); the filling machine comprising: - a feed line , which supplies cartridges (C) to be filled with their corresponding ends (E) facing upwards; and - a filling station , which receives the cartridges (C) to be filled and comprises at least one dispensing nozzle , which is mobile along a path of forward stroke and is pre-arranged for dispensing a product; said machine being characterized in that it comprises: - first inspection means configured for inspecting the ends (E) of the cartridges (C) to be filled in order to identify, for each one, the position of the corresponding open area (A); and - an orientation station , which receives the cartridges (C) to be filled that have been inspected; the orientation station comprises orientation means , configured for rotating each cartridge (C) about its own longitudinal axis (H), on the basis of the corresponding identified position, bringing the open area (A) into a position corresponding to a pre-set reference position, for enabling entry of the dispensing nozzle into the open area (A) of the cartridge (C) when the dispensing nozzle is driven along the path of forward stroke. the filling machine comprising: - a feed line , which supplies cartridges (C) to be filled with their corresponding ends (E) facing upwards; and - a filling station , which receives the cartridges (C) to be filled and comprises at least one dispensing nozzle , which is mobile along a path of forward stroke and is pre-arranged for dispensing a product; - a feed line , which supplies cartridges (C) to be filled with their corresponding ends (E) facing upwards; and - a filling station , which receives the cartridges (C) to be filled and comprises at least one dispensing nozzle , which is mobile along a path of forward stroke and is pre-arranged for dispensing a product; said machine being characterized in that it comprises: - first inspection means configured for inspecting the ends (E) of the cartridges (C) to be filled in order to identify, for each one, the position of the corresponding open area (A); and - an orientation station , which receives the cartridges (C) to be filled that have been inspected; the orientation station comprises orientation means , configured for rotating each cartridge (C) about its own longitudinal axis (H), on the basis of the corresponding identified position, bringing the open area (A) into a position corresponding to a pre-set reference position, for enabling entry of the dispensing nozzle into the open area (A) of the cartridge (C) when the dispensing nozzle is driven along the path of forward stroke. - first inspection means configured for inspecting the ends (E) of the cartridges (C) to be filled in order to identify, for each one, the position of the corresponding open area (A); and - an orientation station , which receives the cartridges (C) to be filled that have been inspected; the orientation station comprises orientation means , configured for rotating each cartridge (C) about its own longitudinal axis (H), on the basis of the corresponding identified position, bringing the open area (A) into a position corresponding to a pre-set reference position, for enabling entry of the dispensing nozzle into the open area (A) of the cartridge (C) when the dispensing nozzle is driven along the path of forward stroke. <EOS>