The rapid growth of photovoltaic (PV) power generation is recognized as a key solution for climate mitigation and future energy demands. However, this expansion often involves significant land use, particularly on croplands, which leads to conflicts over land use and poses hidden threats to food supply. Addressing the dual challenges of food insecurity and energy demand necessitates a thorough analysis of the global impact of solar projects on cropland and food production. Here, we examine the spatiotemporal footprint of PV installations on cropland and associated food production losses; through revealing the trade-offs between energy and food, we forecast the future energy threat to food security under various scenarios. Findings indicate an exponential increase of PV installations on cropland, covering 1372 km2 or 27% of PV facilities by 2018, with over a third situated on high-yield field. The proportion of cropland occupied fluctuates and peaks at 61% in 2007, while the hotspots shift towards higher quality cropland. Food production losses from this trend reach ~4 petacalories in 2018, an amount capable of feeding 4.3 million people for a year, about one third is attributed to China’s surge in PV power. Projections up to 2050 suggest that annual food losses will escalate to ~62 petacalories, a 20,000-fold increase from 2003. Whereas implementing area- and cost-based interventions regarding PV deployment is expected to bend the food loss curve by 47% and 25%, respectively. This study presents a first global analysis of the conflicts between solar power generation and food production, alongside favorable insights for reconciling food and energy security.