Introduction

Mycotoxins are toxic secondary metabolites mainly produced by Aspergillus, Fusarium, or Penicillium species, and pose major threats to global food safety due to their high prevalence and serious negative biological effects1. Among them, aflatoxin B1 (AFB1) is the most potent and best characterised, with strong genotoxic, mutagenic and hepatocarcinogenic effects2. The International Agency for Research on Cancer (IARC) classifies AFB1 as a Group 1 carcinogen, i.e., carcinogenic to humans3. Despite the wide implementation of good agricultural and storage practices, aflatoxin contamination remains pervasive because fungal growth and toxin biosynthesis are difficult to fully control across diverse agro-ecological environments4.

In recent years, there has been increasing evidence showing that climate change significantly exacerbates the contamination of aflatoxins, especially AFB1, in some major crops such as maize and peanuts. Field and modeling studies conducted in Europe, sub-Saharan Africa, and North America have demonstrated strong correlations between extreme weather events, such as heatwaves, prolonged droughts, and intense rainfall, and AFB1 contamination risks in crops5,6,7,8. A recent global systematic review of aflatoxins in nuts reported that peanuts exhibit some of the highest contamination levels among nut types, with mean concentrations of about 32.8 μg/kg for AFB1 and 37.9 μg/kg for total aflatoxins across international studies, highlighting peanuts as a major dietary source of aflatoxin exposure worldwide9. Together, these studies highlight the need for climate-informed prediction strategies to anticipate aflatoxin risks and protect public health10,11.

Peanuts (Arachis hypogaea L.) are a key dietary source of edible oil and protein. China is the largest producer of peanuts all over the world, contributing to approximately 40% of the total output. The cultivation area of peanuts in China exceeds 4.5 million hectares, spanning from the humid subtropical zone in the south to the temperate zone in the north12. Due to this vast geographical diversity coupled with increased climate variability, peanut production in China is particularly vulnerable to aflatoxin contamination2. Aflatoxin comtamination does not directly reduce yield, but it severely affects quality, causing significant economic losses and serious risks to food security. Reflecting these risks, regulatory maximum levels for AFB1 in peanuts are very strict worldwide. In China, a legal limit of AFB1 is set at 20 μg/kg for peanut and its products13, whereas in the European Union, Commission Regulation (EU) 2023/915 establishes AFB1 limits typically ranging from 2–8 μg/kg and 4–15 μg/kg for total aflatoxins (B1, B2, G1 and G2) in groundnuts and derived products, depending on processing and intended use14. These stringent thresholds imply that even moderate increases in the frequency of exceedances can have major implications for food safety and trade in peanut-producing regions.

China’s major peanut-producing regions are primarily located in the eastern monsoon areas, spanning warm-temperate to subtropical climate zones. According to the Köppen climate classification, these regions are dominated by temperate and subtropical monsoon climate types that have experienced clear warming signals and shifts in hydrothermal regimes over the past decades15,16,17. Recent analyses further suggest that under a 2.0 °C warmer climate, many cities across eastern China are likely to experience more frequent and intense heatwaves, hot-humid events, and heavy precipitation18. Such changes in both mean climate and extremes can substantially alter the environmental suitability for Aspergillus flavus infection and AFB1 production during crop growth, harvest, and storage, underscoring the need to explicitly consider regional climate background and extremes in AFB1 risk assessments for peanuts in China.

Predictive modeling using climate and environmental variables has emerged as an effective method for forecasting aflatoxin contamination and mitigating its associated risks19. For instance, a recent national-scale study projected that more than 89.5% of corn-producing counties in the United States will experience increased aflatoxin contamination under mid-century climate scenarios20, highlighting the global relevance of scenario-based aflatoxin risk prediction models. In China, a recent spatial analysis of dietary exposure to aflatoxins from peanuts and peanut oil estimated mean aflatoxin intakes of ~1.8–1.9 ng/kg bw per day in the general population, corresponding to very low margins of exposure and measurable liver cancer risks in certain regions21. Climate extremes, such as droughts, heatwaves, and heavy rainfall associated with tropical cyclones, have been shown to significantly increase aflatoxin risks in multiple crops22,23,24,25. These findings together highlight the need to better understand the spatiotemporal dynamics of aflatoxin contamination under climate change to support field management and food-security planning.

Previous data-based assessments of aflatoxin contamination in peanuts have primarily relied on small-scale field experiments26,27. However, due to the great geographical diversity of peanut cultivation areas across China28, it is still a challenge to accurately assess the scale and magnitude of aflatoxin contamination in peanuts via limited field experiments or laboratory studies. The use of prediction models that can account for the interactions between climate change and aflatoxin contamination offers an alternative approach to understanding the large-scale dynamics29. In addition, GIS-based aflatoxin risk prediction platforms developed for other crops have demonstrated the great value of spatial modeling tools in large-scale aflatoxin risk management30. These advances suggest that it is both feasible and urgent to leverage observational peanut data in China and apply geostatistical and machine-learning techniques to quantify the spatiotemporal variability of AFB1 contamination31.

In this study, we first compiled a unique dataset on the occurrence of AFB1 in peanuts in China based on national statistical records over an extended period. The dataset comprises 17,263 analytical records from 2009 to 2022. Using this dataset, we addressed three main objectives: 1) determine the dynamic variations in peanut aflatoxin contamination levels in China over 2009-2022 in the context of climate change; 2) identify the climatic factors that significantly influence aflatoxin contamination in peanuts; and 3) predict the impact of climate change on future peanut aflatoxin contamination levels.

Results

Changes in aflatoxin B1 contamination since 2009

From 2009 to 2022, 17,263 peanut samples were collected from main producing area in China, and the distribution of the sampling sites is shown in Fig. 1a. Henan Province and Shandong Province are the two central peanut-producing areas in China, accounting for 14.96% and 13.26% of the total peanut sampling sites, respectively (Fig. 1b).

Fig. 1: Spatial and temporal patterns of peanut sampling and AFB1 contamination.
Fig. 1: Spatial and temporal patterns of peanut sampling and AFB1 contamination.
Full size image

a The red pushpins represent specific sampling sites from 2009 to 2022. Light blue, ocher, sky blue, and orange represent the peanut production area in the Northeast, the Yellow River Basin, the Yangtze River Basin, and the southeastern coast, respectively. b Spatial distribution of peanut sampling from 2009 to 2022. c Spatial pattern of the average AFB1 from 2009 to 2022. d Time series of AFB1 from 2009 to 2022 and the distribution of the trend of each province. The bar is the mean value of the time series AFB1 at the country level, and the gray vertical line refers to one standard deviation of the time series AFB1. The red horizontal line indicates the Chinese regulatory limit for AFB1 in peanuts (20 μg·kg⁻¹). The asterisk indicates a significant difference with zero based on a two-sided t-test, with p < 0.05. The inset histogram shows the distribution of provincial mean AFB1 concentrations (mean = 13.88 μg·kg⁻¹). The inset map shows Nanhai Zhudao.

The average AFB1 contamination level increased from 1.29 μg·kg–1 in 2009 to 39.49 μg·kg–1 in 2017, followed by certain decreases, and reached the peak level (48.25 μg·kg–1) in 2021 (Fig. 1d).

During the whole study period, the mean AFB1 contamination level of peanut samples was 13.88 μg·kg–1 (Fig. 1c and d). From a spatial perspective, the average AFB1 contamination was higher in the southeastern coastal region (10.32 μg·kg–1) and the Yangtze River Basin (23.43 μg·kg–1) (Table S1), while lower in the northeastern region (0.09 μg·kg–1) and the Yellow River Basin (7.37 μg·kg–1). With the help of national standard detection method (LOD, 0.03 μg·kg–1), the mean AFB1 detection rate was 30.38% in the Yangtze River Basin and 18.46% in the southeastern coastal region, and was lower in the Yellow River Basin (0.88%) and the northeastern region (13.71%).

Notably, some regions consistently had higher average AFB1 contamination levels. For example, Jiangxi Province exceeded the higher risk of AFB1 contamination. By contrast, the northeastern region, such as Jilin and Liaoning, show very low contamination levels (Fig. S1). Henan Province showed significant increases in AFB1 contamination after 2014, and a similar trend was observed for Shandong Province and Hebei Province. In the northeastern region, no AFB1 contaminated peanut sample was found in Liaoning and Jilin. Moreover, both AFB1 contamination and mean temperature during peanut harvest have been increasing year by year in the northeastern and northern regions (> 32°N) with global warming.

Climate variables related to AFB1 contamination based on a random forest model

High temperatures (25.7–31.3 °C) and drought in 4–6 weeks before harvest have been reported to increase the risk of AFB1 contamination in peanuts32. The month before harvest was identified as the critical period for climate conditions to influence AFB1 contamination33. AFB1 contamination is closely associated with climatic and environmental conditions that affect the growth of Aspergillus flavus (A. flavus) and the production of aflatoxins. Previous studies have shown that environmental factors, such as high temperature, drought stress, and humidity, strongly affect fungal proliferation and toxin biosynthesis in crops34,35. Based on these biological and environmental mechanisms, we selected eight climate-related variables as potential driving factors of AFB1 contamination (Table S2), including daytime temperature (Tmax), nighttime temperature (Tmin), average temperature (Tave), precipitation (Prc), atmospheric pressure (Pre), relative humidity (Rh), evaporation (Eva), and wind speed (Ws).

Figure S2 presents the correlations between AFB1 contamination and various climate-related factors. Although seven of the eight factors exhibited statistically significant correlations (p < 0.05), the correlation coefficients were generally low, with the highest (0.19) being found for the temperature-related variables (Tave, Tmax, and Tmin). After detrending the potential driving factors, their correlations with AFB1 remained consistent (Table S3). Fig. S3 further summarizes province-stratified correlations. When correlations were first calculated within each province and then aggregated, Tmax, Pre, Prc, and Eva tended to be positively correlated with AFB1, whereas Tave, Tmin, and Ws tended to show negative correlations. These results suggest that linear analysis may be insufficient to fully capture the complex interactions between climatic factors and AFB1 contamination. Interestingly, the temperatures related to AFB1 contamination were mainly concentrated around 28 °C and 22 °C (Fig. S2a). We then created a box plot of the average temperature for AFB1 contamination in different areas during one month before the harvest. In south regions, the temperature in high-risk areas (county average AFB1 contamination ≥10 ppb) was 27.56–29.83 °C (IQR, 25th–75th percentile; same below) with a median of 28.68 °C, which was significantly higher than that in low-risk areas (county average AFB1 contamination < 10 ppb) with a temperature range of 27.05–29.35 °C and a median of 28.34 °C (p = 0.02, t-test and two-tailed methods) (Fig. S4). In north regions, the temperature in high-risk areas was 21.18–23.63 °C with a median of 22.31 °C, which was also significantly higher than that in low-risk areas with a temperature range of 19.42–22.65 °C and a median value of 21.44 °C (p < 0.001).

We then compared the performance of eleven Random Forest (RF) models built under two sets of thresholds, county-level mean contamination (0, 5, 10, 20 ppb), and exceedance rate (0, 1, 5, 10, 20, 50, 100%), with a particular focus on the overall accuracy and recall rate for high-risk (Pos) samples (Table S4). For the mean contamination threshold, the model using a threshold of > 0 ppb (Aver_0) achieved a test set accuracy of 0.61 and a high-risk recall rate of 0.72 (Fig. 2b). Increasing the threshold to 5, 10, and 20 ppb raised the accuracy to 0.75, 0.79, and 0.85, but led to a sharp decline of the high-risk recall rate to 0.19, 0.16, and 0.20, respectively. Although higher thresholds could improve the overall accuracy, they dramatically increased the missing rate of high-risk cases. In contrast, the Aver_0 model best captured true high-risk cases. Since our primary objective is to minimize the false negatives among high-risk areas, we selected the Aver_0 model.

Fig. 2: Performance of RF model in predicting AFB1 contamination.
Fig. 2: Performance of RF model in predicting AFB1 contamination.
Full size image

ac Confusion matrices for the training set, test set, and external validation. “Pos” and “Neg” denote high-risk and low-risk classes, respectively (defined by the county-level mean AFB1 threshold, Aver_0). d Features ranked by their contributions to the classification accuracy (Mean decrease in Gini).

On the training data (Fig. 2a), the RF model could well discriminate high-risk areas, with an overall accuracy of 0.93 and a Cohen’s kappa coefficient of 0.85. Treating “high-risk” as the positive class, the model achieved a sensitivity of 0.91, and could correctly identify 91.35% of true high-risk areas. The positive predictive value was 0.96, indicating that about 96% of the areas marked as high-risk were indeed positive. The F1-score was 0.94, indicating a balanced trade-off between precision and recall for the high-risk class, and balanced accuracy also reached 0.93, reflecting comparable performance in correctly identifying both high- and low-risk areas. On the held-out test set (Fig. 2b), the model maintained potent detection of high risks, with a sensitivity of 0.72, a positive predictive value of 0.65, and a F1-score of 0.68. The overall accuracy was 0.61 and the balanced accuracy was 0.59, demonstrating robust ability of the model to capture most of the true high-risk areas in the test data. The independent external validation set (2018–2022; Fig. 2c) comprised 333 records, among which 36 were AFB1-positive, and the test results showed that the sensitivity was 0.83. Hence, about 83% of contaminated records could be correctly marked and only six positive records failed to be detected.

Figure 2d shows the variable importance analysis results derived from a RF model incorporating 21 climatic variables. The results showed that Ws and Prc were the primary factors that influenced the classification of AFB1 contamination risks. Tmin also exhibited high importance, indicating its significant role in determining the AFB1 contamination risk. By contrast, Rh exhibited lower importance and, therefore, may have relatively limited impacts on the classification model. These results further underscore the significant roles of key climatic factors such as the minimum temperature, precipitation, and wind speed in predicting the AFB1 contamination risk, providing theoretical support for constructing a Bayesian model for contamination risk prediction based on climatic factors.

Spatial variations of aflatoxin B1 contamination in response to climatic factors

A hierarchical Bayesian model was used to quantify the spatial variations of AFB1 contamination in response to climatic factors. This model can account for the spatial structure and uncertainty of AFB1 contamination in response to climatic factors and effectively demonstrate the impacts of climate change. Furthermore, due to the evident spatial heterogeneity of AFB1 contamination and its correlations with climatic factors, the statistical distribution of the response of AFB1 contamination to climatic factors varied across different areas, which could be effectively addressed by the Bayesian model. In this study, we applied six factors significantly correlated with AFB1 contamination (Pre, Tmax, Tmin, Prc, Eva, and Ws) to construct a statistical model for AFB1 contamination in peanuts. This model could capture the heterogeneous response of AFB1 contamination in peanuts to variations in these climatic factors during the month before harvest (Fig. 3a), and the leave-one-out cross-validation (LOO-CV) method was used to validate the prediction accuracy of the Bayesian model36 (Fig. S5). Overall, the posterior distribution of Tmax, Eva, and Ws exhibited positive correlations with AFB1 contamination. Ws showed the greatest mean posterior distribution with an average of 0.41. By contrast, Pre, Tmin, and Prc mostly exhibited negative posterior distributions, except for positive posterior distributions of Pre in several provinces. Moreover, Pre exhibited significant heterogeneity with a maximum value of 0.04 and a minimum value of –0.09, and AFB1 contamination exhibited a negative sensitivity to Pre in four provinces.

Fig. 3: Contribution of climate factors to variations in AFB1 contamination from 2009 to 2022.
Fig. 3: Contribution of climate factors to variations in AFB1 contamination from 2009 to 2022.
Full size image

a Posterior distribution of climatic factors (sensitivity of AFB1 to climate factors) in all provinces. b Relative contribution rate of each climate variable in each province. ch Spatial pattern of sensitivity of AFB1 to climatic factors (c. SPre: sensitivity of AFB1 contamination to Pre, the same for (d). STmax. e STmin. f SPrc. g SEva. h SWs.). The inset map shows Nanhai Zhudao.

Based on the observed relationships between climatic factors and AFB1 contamination, we estimated the relative contribution of different climatic factors to variations in AFB1 contamination since 2009 (Fig. 3b). AFB1 contamination exhibited a strong sensitivity to Ws, and the average contribution of Ws was 41.94% across all the provinces. In Jiangsu, Ws had the greatest contribution (exceeding 45.69%) to AFB1 contamination among all climatic factors. In Hebei, Tmin had the most significant relative contribution (32.56%).

Among all the tested climatic factors, Tmax and Tmin accounted for nearly half of the variations in AFB1 contamination with a total relative contribution of 49.46%. Tmax had exceptionally high relative contribution in the northern provinces such as Liaoning, Shandong, and Jilin, particularly in Jilin (23.03%). The changes in Tmin also had significant contributions in northern provinces (Liaoning, Shandong, and Jilin) and certain southern provinces (Guangdong). These results indicated the importance of temperature changes, especially during the nighttime, in influencing AFB1 activity37. Other notable climatic factors included Pre and Prc, which together accounted for about 5% of variations in AFB1 contamination. AFB1 contamination exhibited the highest sensitivity to Prc (8.18%) in Anhui. The sensitivity of AFB1 contamination to Pre ranged from a minimum of –0.09 μg·kg−1/hPa to a maximum of 0.07 μg·kg−1/hPa. Remarkably, AFB1 contamination in Jiangxi Province exhibited the most pronounced positive response to Pre, reaching a peak sensitivity of 0.07 μg·kg−1/hPa (Fig. 3c).

As shown in Fig. 3d, AFB1 contamination exhibited a predominantly positive sensitivity to Tmax across all provinces, as denoted by STmax in the figure, which ranged from 0.18 μg·kg−1/°C to 0.23 μg·kg−1/°C. Conversely, AFB1 contamination exhibited a negative sensitivity to Tmin across all provinces, as indicated by STmin in Fig. 3e, which ranged from –0.31 μg·kg−1/°C to –0.25 μg·kg−1/°C.

In contrast to the sensitivity to temperature, the sensitivity of AFB1 contamination to Prc was not significant (Fig. 3f). The analysis revealed that the response of AFB1 contamination to Prc exhibited significant spatial heterogeneity. A positive sensitivity was observed in the Yellow River Basin and the northeast region, peaking at 0.04 μg·kg−1/mm in Henan. By contrast, a negative sensitivity was observed in the upper and lower parts of the Yangtze River Basin, and the most pronounced sensitivity of –0.09 μg·kg–1/mm was recorded in Anhui. Moreover, the response of AFB1 contamination to Eva, denoted as SEva in Fig. 3g, generally exhibited a positive trend in most provinces, ranging from –0.02 μg·kg–1/mm to 0.14 μg·kg-1/mm. The sensitivity of AFB1 contamination to Ws, as denoted by SWs in Fig. 3h, was predominantly positive across the surveyed provinces, achieving a maximum value of 0.43 μg·kg−1/m·s−1 in Fujian. It was slightly lower (0.39 μg·kg–1/m·s−1) in the northern regions, such as Jilin Province.

The sensitivity of AFB1 contamination to Tmax exhibited significant regional consistency, with the highest sensitivity being observed in Jiangxi Province (0.23 μg·kg−1/°C). Although there were minimal differences between different provinces, this consistent positive distribution suggests that climatic factors, particularly Tmax, have significant impacts on AFB1 contamination, especially in the Yangtze River Basin. The higher sensitivity of AFB1 contamination to Tmax in this region coincided with the critical peanut harvest period from late August to early September (Table S5). These temperatures were close to the optimal range for AFB1 growth, indicating that an increase in Tmax may significantly increase the risk of AFB1 contamination.

By contrast, the response of AFB1 contamination to Tmin predominantly exhibited negative sensitivity across all provinces, with the most pronounced negative sensitivity being observed in Hebei and Anhui. This pattern highlights the aggravation effect of lower Tmin on AFB1 contamination, possibly due to increases in the daily temperature difference.

The sensitivity of AFB1 contamination to Prc (SPrc) exhibited profound spatial heterogeneity. Positive sensitivity was observed in the central and northeastern regions, indicating that the risk of contamination increased with increasing Prc. By contrast, AFB1 contamination in the upper reaches of the Yangtze River and parts of the southeastern coastal regions exhibited negative sensitivity to SPrc, suggesting that increased Prc may reduce the risk of AFB1 contamination. This varying response highlights the complex interactions between regional climate conditions and AFB1 contamination risk, underscoring the importance of developing tailored management strategies to mitigate the spread of AFB1 under different climate scenarios.

Projection of climate-driven changes in aflatoxin B1 contamination by the end of this century

By using the same model, we conducted bias-corrected climate change projections under two different Shared Socio-economic Pathways (SSPs) scenarios (SSP126 and SSP585), and projected the climate-driven changes in AFB1 contamination by 2100 (Fig. 4). SSP126 and SSP585 represent sustainable development and high-emission pathways, respectively, and are the best and worst climate warming scenarios in the future. By using a logistic regression, we projected the AFB1 exceedance rate in each province under these two scenarios and preliminarily estimated the potential yield loss of peanuts resulting from the elevated contamination rate.

Fig. 4: Projection of AFB1 contamination from 2023 to 2100 under two scenarios.
Fig. 4: Projection of AFB1 contamination from 2023 to 2100 under two scenarios.
Full size image

a Spatial pattern of the change in AFB1-contaminated peanut mass at the end of the century (EC). The boxplots depict the projected increase in the tonnage of peanuts estimated to exceed the AFB1 limit, relative to the historical baseline for the same grid cells. b Spatial pattern of changes in AFB1 contamination projected for different provinces. c Spatial pattern of the exceedance rate of AFB1 contamination in EC. The box plots show the projected rate of changes in AFB1 compared with the historical rate at various periods. NF represents the near future (2023–2039), MC represents mid-century (2040–2069), and EC represents the end of the century (2070–2100). Red and green boxes also represent the projected rate of change under SSP585 and SSP126. The inset maps in b, c, and d show Nanhai Zhudao.

The calculation results revealed that about 478,400 tons of peanuts were contaminated nationwide in 2022 (Table S7). By the end of the century, the amount was projected to rise to 1.16 million tons under both future climate scenarios (Fig. 4a). It should be noted that the northeastern provinces of Liaoning and Jilin, which currently exhibit no detectable aflatoxin contamination and an exceedance rate of 0%, were excluded from the discussion of yield losses.

Among the remaining provinces, Henan showed the largest projected increase, with an additional 347,600 tons of peanuts being projected to exceed the AFB1 limit (Table S6). Jiangsu showed the slightest increase (by about 7,150 tons). Intermediate increases were projected for Hebei, Anhui, Fujian, and Guangdong, with each ranging from 9,200 tons to 15,100 tons of contaminated peanuts.

Moreover, the mean AFB1 contamination was predicted to increase from 13.88 μg·kg–1 in 2009–2022 to 15.12 and 15.06 μg·kg–1 by the end of this century under SSP126 and SSP585, respectively (Fig. 4b). The box plots in Fig. 4b present the projected changes over different periods and under different scenarios. Under SSP126, it was predicted that the AFB1 contamination will continuously increase and reach the maximum value at the end of this century. By contrast, under SSP585, AFB1 contamination will reach the highest value in the near future (2023–2039). Thus, the differences between the predicted changes under SSP585 and SSP126 are more prominent in the near future (2023–2039) than those in the middle (2040–2069) and the end of this century (2070–2100). Both scenarios resulted in similar growth rates, about 0.15 μg·kg⁻¹ per decade (Fig. 4c). In addition, the change will be much greater under SSP585 than under SSP126 in the near future. The timing of these projected changes suggests that while there are less pronounced differences between SSP126 and SSP585 by the middle and end of the century, the AFB1 contamination will probably increase significantly in the near future under severe warming trends. Thus, it is highly necessary to design and implement effective strategies to mitigate the potential future risks.

We also analyzed the spatial pattern of the increases in AFB1 contamination by comparing the predicted AFB1 contamination (2023–2039, 2040–2069, and 2070–2100) with the historical records (2009–2022). The two scenarios lead to significant spatial heterogeneity of the changes in AFB1 contamination under average conditions. Overall, the AFB1 contamination risk is relatively high in the Yangtze River Basin, followed by that in the south, and is relatively low in the north. Specifically, Jiangxi Province in the Yangtze River Basin was projected to have the greatest increase in AFB1 contamination by the end of this century, which will be increased by 4.73 μg·kg–1. Among different provinces, it was predicted that Jiangxi Province will undergo a 2.40 μg·kg–1 increase in AFB1 contamination in the near future (2023–2039), which is the most significant increase in the Yangtze River Basin (Figs. S6, S7).

The provinces in northeast China show the slightest increases (0.38 μg·kg⁻¹ in Jilin and 0.37 μg·kg⁻¹ in Liaoning) in AFB1 contamination, but exhibit the fastest relative growth rate, which was projected to reach 1879.45% and 286.41% by 2100 (Fig. 4b). The contamination level will remain low despite the rapid growth. In northern China, most provinces show considerable growth rates, except for Henan and Shandong. AFB1 contamination in Henan will undergo a significant increase, rising by 2.88 μg·kg⁻¹ (2020–2039) and 3.02 μg·kg⁻¹ by 2100, and timely interventions are required to mitigate these risks. The increases in AFB1 contamination in the southern and southeastern coastal regions are only next to those in Yangtze River Basin. Fujian will undergo the most dramatic increase in AFB1 contamination among all coastal provinces, where the AFB1 level will increase by 2.97 μg·kg⁻¹ in the mid-century. Despite relatively slighter absolute increases, Guangdong has the fastest growth rate (23.29%) by 2100, reflecting its vulnerability to typhoons and other extreme climate impacts.

Our Bayesian models were based on the observed heterogeneous responses of AFB1 contamination to climatic factors across different provinces, and can account for the influence of various climatic factors such as temperature and precipitation. However, in terms of spatial resolution, the AFB1 data can be processed into more refined data to match with the higher-resolution climate data in further research. It will be important to understand the contamination process of aflatoxins in different peanut-producing regions, monitor the dynamics of their variations between years, and clarify their responses to more severe climate changes for minimizing AFB1 contamination in the future.

Discussion

Global annual peanut production is estimated to be approximately 39.9 million tons. However, aflatoxin contamination causes substantial production and economic losses of peanuts, particularly in major peanut-producing countries such as China, the United States, Argentina, Sudan, Senegal, and Brazil, where peanuts often fail to meet international aflatoxin standards38. In Europe, about 700,000 tons of peanuts are consumed each year, but over the past five years, aflatoxin levels in peanuts exported from China to Europe have exceeded the European Union’s legal limits by more than 180 times4. These observations underscore the significant influence of aflatoxin contamination, especially for peanuts produced in tropical and subtropical regions that are climatically prone to AFB1 risk. Consistent with this broader picture, our data show a mean exceedance rate of 3.55% for AFB1 from 2009 to 2022 in China, corresponding to more than 8 million tons of peanuts above the national regulatory limit (Table S7). Chronic exposure to aflatoxins has been associated with increased liver cancer risk in China, with particularly elevated risks reported in high-risk provinces such as Guangdong, Fujian and Jiangxi12, further highlighting the public-health relevance of controlling peanut AFB1 contamination.

Based on the 17,263 monitoring records analyzed in this study, the overall arithmetic mean concentration of AFB1 in peanuts and peanut products in China during 2009–2022 was 13.88 μg·kg–1 (Fig. 1d). This value is lower than the global mean AFB1 concentration in peanuts (32.8 μg·kg–1) reported in the systematic review by Ebrahimi et al. (2000–2020) but higher than their China-specific mean aflatoxin concentration of 6.48 μg·kg–1 for peanuts over the same approximate period9. Several factors may explain these differences, including (1) the focus of our dataset on routine regulatory monitoring of higher-risk batches and regions, (2) differences in sampling strategies, analytical methods and time coverage between individual studies compiled in the review and the national monitoring system. Nevertheless, both the global review and our monitoring data consistently indicate that peanuts are a key vehicle for AFB1 exposure and that contamination levels in China remain of concern, especially in high-risk years and regions.

An effective framework for managing AFB1 risk in peanut production should link spatial hotspots with contamination magnitude and the underlying climatic drivers39. Such understanding supports early warning, targeted mitigation of production losses and the protection of consumer safety, and requires explicit consideration of how climate change may alter AFB1 occurrence, particularly under future warming scenarios40. This perspective complements previous research that has mostly focused on toxin-producing fungi41, geo-statistics42, and molecular biology43, but has less often integrated nationwide monitoring with climate-responsive risk modelling.

This study used a county-level hierarchical Bayesian model combined with variable screening and importance ranking by RF, and dynamically adopted the ‘30 days before harvest’ window in each year. From a methodological perspective, our framework inherits the concept of AFLARISK at the mechanism level, draws on the adaptive machine learning advantages of PREMA at the data level5, and makes full use of China’s high-density monitoring data to carry out model construction and verification at the county-year scale.

At sub-national resolution, only a few peer-reviewed studies have incorporated spatial autocorrelation into aflatoxin risk mapping for maize-growing regions in the United States. One study applied Poisson kriging to interpolate county-level AFB1 contamination from fewer than 200 annual field samples, effectively identifying localized hotspots associated with AFB1 contamination under drought conditions6. A subsequent investigation extended this approach by employing profile regression and spatial clustering to address variable collinearity and spatial dependence, enabling the classification of counties into distinct aflatoxin risk regimes10. More recently, these spatial modeling strategies were coupled with future climate simulations (such as RCP4.5 and RCP8.5) to project the potential shifts in aflatoxin risk under warming scenarios, using predefined climatic thresholds such as Tmax > 30°C and rainfall < 50 mm during June44. Collectively, these studies provide a useful methodological foundation for linking environmental conditions with aflatoxin dynamics through spatial risk modelling.

Our study differs from previous studies in three key aspects. First, regarding spatial scale and coverage, earlier work in southern Georgia focused on county-level datasets within a single U.S. production region, whereas our panel dataset covers multiple provinces across China’s four major peanut-producing regions, enabling a national-scale analysis of the climatic drivers. Second, in terms of temporal resolution, the Georgia studies pooled five-year data into a static kriging model. In contrast, we dynamically adopted the 30-day pre-harvest window and harvest timing for each year, allowing the capture of inter-annual variability in aflatoxin risk, which cannot be resolved by traditional kriging methods. Third, our modelling framework differs from sequential kriging and spatial regression approaches. We implemented a two-tier system in which Random Forest is used to identify dominant climatic predictors and a hierarchical Bayesian model is used to incorporate residual spatial dependence via county-level random intercepts and to project future risks under CMIP6 climate scenarios.

In general, these distinctions highlight how high-density, national-scale monitoring data advance aflatoxin risk modeling from localized interpolation toward predictive, climate-responsive frameworks.

Notably, most previous studies have predominantly used the daily mean temperature to assess the impact of climate warming. However, this approach may introduce bias due to the asymmetric effects of daytime and nighttime temperatures on AFB1 occurrence45. In this study, we found that AFB1 exhibited a more pronounced response to nighttime temperatures. These asymmetric may amplify climate-driven changes in AFB1 risk in regions where AFB1 shows stronger sensitivity to nighttime temperature increases at a faster rate46. This pattern is consistent with previous findings in maize systems, where minimum temperature was more strongly associated with aflatoxin risk than either daily mean temperature or rainfall47. The spatial heterogeneity of night-time warming trends under SSP585, with stronger warming in mid- to high-latitude regions, may help explain the more rapid predicted increase in AFB1 contamination in northern China (Fig. 4b).

Temperature and rainfall are critical climatic factors in agricultural production, and their impacts on aflatoxin contamination cannot be overlooked. In our dataset, higher AFB1 levels were observed in counties experiencing warmer and wetter conditions during the month before harvest. Temperatures above about 30 °C strongly promote the growth of aflatoxin-producing fungi, with maximum growth rates around 35 °C48, which helps to explain the higher contamination levels observed in peanut-producing regions in the Yangtze River Basin and southeastern coastal areas compared with northeastern regions and the Yellow River Basin (Table S5). High temperatures can also induce drought stress, further affecting aflatoxin contamination in peanut fields49. Given that most peanut production in China occurs in temperate regions, continued warming and associated drought conditions may exacerbate AFB1 contamination in many production areas.

Rainfall represents a significant source of uncertainty in our estimation. In contrast to temperature, rainfall exhibits considerable heterogeneity and randomness, with substantial inter-annual variability across regions in the month before peanut harvest. Rainfall can increase the soil moisture, creating a humid environment conducive to the growth of A. flavus50. The moist surface of peanut shells facilitates the invasion and proliferation of aflatoxin-producing fungi, thereby increasing aflatoxin production. Similar climate-induced uncertainties have been documented in rain-fed maize systems, where shifts in rainfall distribution reshape land suitability and crop vulnerability51, further highlighting the need to consider precipitation extremes in aflatoxin risk modelling, particularly in typhoon-prone regions of southern China. In China, extreme rainfall events frequently occur in major peanut-producing provinces, including Henan, Anhui, Hubei and Hunan. While moderate rainfall can increase water activity and sometimes reduce aflatoxin contamination52, excessive rainfall, particularly that caused by typhoons53, can lead to prolonged soil and pod wetness, delayed harvest and substantially higher contamination risks. Taking Guangxi Province as an example, Fig. S9 shows that years with more extreme rainfall events in the month before harvest tended to have higher aflatoxin detection rates. As extreme rainfall events are projected to increase in the future54, precipitation extremes may warrant particular attention in future AFB1 risk assessments.

Wind speed is an easily overlooked climatic factor, but it was found to be a crucial factor in this study. Although temperature and moisture conditions directly regulate fungal infection and toxin formation, wind primarily influences mycotoxin risk through indirect pathways, notably by dispersing fungal spores across fields and regions55. Moreover, a higher wind speed can accelerate soil evaporation, particularly in the month before peanut harvest, which can result in sustained soil drought conditions to elevate aflatoxin contamination. In addition to geographic influences, the occurrence of typhoons is a key factor affecting wind speed, often resulting in abrupt changes in wind speed and atmospheric pressure over a short period.

Our results also suggest that aflatoxin contamination is influenced by climate extremes, particularly tropical cyclones. Fig. S10 shows the main landfall routes of tropical cyclones in China from 2009 to 2022, illustrating their overlap with years and regions of high AFB1 contamination. For example, during 2021, Typhoon In-fa (“Fireworks”) contributed to extreme rainfall events in central and eastern China, including Henan, Anhui, Shandong, and neighboring areas56, Anhui, Shandong, and neighboring areas, and mean AFB1 levels in Henan peanuts reached 136.89 μg/kg, much higher than in other years. Similarly, in 2020, Tropical Storm Nuri made landfall in Guangdong and brought strong winds and heavy rainfall affecting parts of Guangdong and Guangxi in June, coinciding with difficulties in peanut harvest and elevated AFB1 levels in Guangxi (124.92 μg/kg). These cases illustrate how tropical cyclones can cause compound extremes of wind and rainfall that substantially amplify local aflatoxin risk.

These empirical patterns are consistent with broader conceptual understanding of how climate change shapes the ecology and spread of A. flavus. Changes in air and soil temperature and humidity directly affect fungal growth and toxin production57, while shifts in growing seasons and the geographic distribution of peanuts may modify host–pathogen interactions across regions58.In addition, climate-driven increases in extreme events such as floods and droughts can alter soil physical and chemical properties and thereby affect the ecosystem dynamics of aflatoxin-producing fungi59.

To mitigate the impact of climate change on aflatoxin-producing fungi and aflatoxin contamination, several measures can be recommended. Strengthened monitoring and early-warning systems, including the use of advanced analytical approaches and machine-learning models, can help anticipate contamination risks weeks in advance60. Genetic improvement and breeding of disease-resistant peanut varieties61, together with biological control strategies such as establishing dominant non-toxigenic A. flavus strains in soil and deploying beneficial microbial agents62, such as Aflatoxin Rhizobia Couple (ARC), can reduce the infection rate of A. flavus and subsequent aflatoxin production63.

Several limitations of this work should be acknowledged. First, the monitoring dataset is predominantly based on geospatially and temporally aggregated AFB1 measurements, which constrains our ability to fully resolve fine-scale heterogeneity, especially in under-sampled provinces with highly localised climate conditions. Second, our models only included meteorological variables and did not explicitly account for soil properties, soil moisture, irrigation practices, or post-harvest and storage conditions, all of which can influence Aspergillus flavus infection and AFB1 production. As harmonized soil and management data become available, future research should extend the present framework towards a peanut–climate–soil integrated system by jointly incorporating soil type, soil moisture and management practices alongside climate drivers. Despite these limitations, our findings provide a quantitative basis for prioritizing surveillance in climate-vulnerable regions, for targeting adaptive agronomic and post-harvest strategies to mitigate aflatoxin contamination, and for embedding AFB1 early warning into broader climate risk management for peanut supply chains in China.

In summary, by compiling a long-term observational dataset of 17,263 records on peanut AFB1 contamination and associated climatic conditions in major producing regions of China during 2009–2022, we characterized the dynamic spatiotemporal patterns of AFB1 risk and identified eastern and southern provinces as persistent and emerging hotspots. Climate-informed statistical models highlighted the critical roles of growing-season temperature, night-time warmth, moisture and hot–humid extremes in shaping interannual and regional variability in contamination. Projections under SSP126 and SSP585 indicate that, assuming no major changes in peanut varieties or cultivation practices, mean AFB1 levels is projected to increase from 13.88 μg·kg⁻¹ (2009–2022) to approximately 15.09 μg·kg⁻¹ by the end of this century. Although these numerical values should not be interpreted as precise farm-level forecasts, the results suggest that continued warming, particularly asymmetric increases in night-time temperature combined with rainfall variability, may substantially elevate AFB1 risk in several key peanut-producing regions. The framework and insights developed here may also be informative for managing aflatoxin risks in other subtropical and warm-temperate production systems worldwide.

Methods

Datasets

A dataset on AFB1 contamination of peanuts across China was developed by utilizing statistical records from the Laboratory of Risk Assessment for Oilseeds Products (Wuhan), Ministry of Agriculture and Rural Affairs (LRAOP). The LRAOP was tasked with investigating risk factors in oilseed crops, including monitoring and analyzing the potential safety risks during production and harvesting, providing guidance to local farmers for risk mitigation, and promptly collecting peanut and other relevant samples for risk factor testing and data acquisition. In this study, we compiled a nationwide dataset on AFB1 contamination of peanuts from 2009 to 2022. The sampling was conducted using a random sampling strategy, ensuring geographical balance across major peanut-producing regions in China to enhance the representativeness of the dataset.

In each year, county-level agricultural extension stations and staff involved in oil risk assessment regularly monitored the growth of peanuts. Upon maturity and harvesting, peanut samples were collected following national and provincial standards and promptly sent to the LRAOP. Risk assessment was conducted following the technical specification application manual throughout the sampling process. At the end of each year, LRAOP staff organized the peanut sample results and uploaded them to the oil quality and safety big data platform for further analysis.

The county-level statistical records, which were regarded as reliable and homogeneous, were utilized to represent the occurrence and impact of AFB1 contamination at the regional level. Drawing on long-term monitoring and statistical data from the LRAOP, we compiled 17,263 records of AFB1 contamination of peanuts from 2009 to 2022, covering over 1300 counties across 14 provinces within China’s four major peanut-producing regions. China’s peanut production areas were divided into the northeast, the Yellow River Basin, the Yangtze River Basin, and the southeast coastal areas (Table S8). This extensive dataset represented 79.17% of the national peanut planting area, as verified by statistical yearbooks of various cities, could ensure the robustness and geographic representativeness of the final findings. The data collection process for AFB1 records was conducted using a bottom-up workflow (Fig. S11).

At the time of peanut harvest, 10–30 peanut samples were collected according to the planting area and yield, and the sample information (including the sampling location, Fig. 1a) was recorded timely and accurately during the sampling process. The collected and shelled peanut samples were dried to a moisture content of less than 10% within one week and then transported to the laboratory and stored in a ventilated and dry environment until the measurement of AFB1 content. Meteorological variables were derived from the ERA5 reanalysis produced by ECMWF and distributed via the Copernicus Climate Data Store64 (https://cds.climate.copernicus.eu). ERA5 provides gridded global estimates generated through numerical modelling and data assimilation and is available at hourly time steps, from which monthly (or other) aggregates can be derived; the spatial resolution used here was 0.25° × 0.25°. Based on previous research32, we selected eight climate variables with potential impacts on peanut aflatoxin contamination from the dataset: Tave, Tmax, Tmin, Pre, Prc, Rh, Eva, and Ws.

We utilized the selected climatic factors to project the AFB1 contamination under the sixth phase of the Coupled Model Intercomparison Project (CMIP6)65. Compared with CMIP5, CMIP6 is featured with improvements in model resolution, physical parameterization schemes, climate variables, experimental design, and data-sharing protocols66. CMIP6 integrates SSPs with representative concentration pathways (RCPs)67. For instance, SSP126 represents a future scenario that integrates SSP1-based socioeconomic development with an energy and land use scenario that aligns with RCP2.6, reflecting a low-emission, sustainable development pathway with strong climate mitigation, under which global mean temperature increase is likely kept below 2 °C by 2100, whereas SSP5-8.5 corresponds to a fossil fuel–intensive, high-emission pathway with projected warming exceeding 4 °C by 2100. In this study, five Earth system models68,69,70,71,72 that utilize monthly climate data for two scenarios, namely SSP126 and SSP585, were employed (Table S9). One limitation of the AFB1 contamination data utilized in this study is the need for complete temporal alignment of the datasets used to conduct the analysis. Previous studies have shown that temperature and rainfall can affect the spread and infection of A. flavus and subsequent AFB1 contamination73. Therefore, obtaining more detailed statistical data and an improved temporal resolution would enhance the assessment on the effects of climatic factors on AFB1 contamination.

Data processing

To ensure spatiotemporal alignment between the AFB1 dataset and climate records, we initially examined the time series data to identify any coverage gaps at the county level from 2009 to 2022. Furthermore, to address the administrative changes in certain counties in China, the county-level data were merged to maintain consistency across both the temporal and spatial dimensions. Ultimately, we compiled AFB1 contamination data spanning four major peanut-producing regions, 14 provinces, 145 cities, and 370 counties (Table S1). The detection for AFB1 in peanuts involved several steps. Initially, impurities, dust, and shells were removed from the peanuts, which were then sliced to a thickness of 0.5 cm using a slicer. The sliced peanuts were subsequently crushed using a sample grinder and ground until the powder, followed by passing through a sieve with a pore size of 0.9 mm. The powdered samples were then stored in sample bottles at 4 °C. The AFB1 content was then determined via high-performance liquid chromatography (HPLC)74.

The mean AFB1 value was defined as the sum of all the detection values within a given county or region divided by the total number of samples collected in that county. The exceedance rate of AFB1 was defined as the proportion of samples from a county or region with detection values exceeding the national standard limit (20 μg·kg-1 for peanuts) to the total number of samples collected. The detection rate of AFB1 was defined as the proportion of samples with detectable AFB1 (recorded as >0) among all samples from a given county or region. The distribution of the annual mean AFB1 values is presented in Fig. S12.

To align with the annual statistical records of AFB1, we averaged the climate variables during the peanut harvest period to obtain yearly data for each area, including the Tave, Tmax, Tmin, Pre, Prc, Rh, Eva, and Ws. The yearly climate data were further disaggregated into monthly data for the period before peanut harvest. The climate variables were adjusted to more accurately reflect the actual agricultural climate conditions. To facilitate future climate projections for AFB1 contamination, we applied the same methodology to process the historical climate variables into monthly output data from five Earth system models. The climate variables for the month before the expected annual peanut harvest were obtained under the assumption that there were no significant changes in the harvesting practices within the region (Fig. S13).

Analysis

The period when peanuts were contaminated with AFB1 was determined based on the team’s previous research. Therefore, the meteorological data used in this study were all from the 30-day period (one month) before the local harvest date33.

Eight climate variables (Tmax, Tmin, Tave, Eva, Rh, Ws, Pre, and Prc) were initially identified as potential factors influencing AFB1 occurrence (Table S2). First, a linear correlation analysis was conducted to evaluate the relationships between these potential factors and AFB1 contamination (Fig. S2). As the observed linear relationships of the individual variables were not the sole determinants of AFB1 occurrence, RF modeling was subsequently employed as a nonlinear feature selection method to identify the most relevant variables75.

We compiled county-level peanut aflatoxin data across China for the period 2009–2017, yielding 910 samples to be used as the training and testing sets. The binary outcome variable was defined by county-level mean AFB1 contamination: counties with a mean value greater than 0 μg·kg⁻¹ were classified as high-risk (Pos), and those with a mean of 0 μg·kg⁻¹ as low-risk (Neg). Twenty-one meteorological predictors, including various temperatures, humidity, precipitation, and wind-speed metrics, were selected. All variables were converted to numeric forms, and any sample with missing values in either predictors or the outcome was excluded, resulting in a complete dataset for modeling. Data import from Excel was performed using the ‘readxl’ package, and data manipulation was carried out using ‘dplyr’.

To preserve the original proportion of high- and low-risk counties and avoid bias due to class imbalance, we performed stratified sampling to partition the data into a training set (70%) and a test set (30%) using the ‘caret’ package. A fixed random seed was used to ensure that this split was reproducible.

On the training set, we trained an RF classifier with the ‘randomForest’ package, specifying 500 trees and p features sampled at each split (where p is the number of predictors). Variable importance was assessed by measuring the decrease in Gini impurity attributable to each predictor.

For external validation (2018–2022), following model development with the 2009–2017 dataset, a fully independent county-level panel for 2018–2022 (n = 333) was analyzed to test temporal transferability. The binary outcome (Pos = AFB1 > 0 μg·kg⁻¹; Neg = 0 μg·kg⁻¹) and the full set of 21 climate factors were defined identically to those in the training phase; the column names were standardized with make.names. When an external predictor column was wholly or partly missing, all NA entries were replaced by the corresponding column mean from the 2009–2017 training data. No records were discarded after imputation, maintaining complete coverage of recent production years. The pre-trained random-forest classifier was then applied (predict(type = “class”)), and performance was summarized with confusionMatrix. As shown in Fig. 2c, the model retained a high sensitivity of 0.83 for detecting AFB1-positive cases, confirming its utility as a forward-looking, early-warning screening tool despite the expected decline in overall accuracy attributable to increases in false-positive rate.

The model performance was evaluated separately on the training and test sets by calculating confusion matrices and standard classification metrics, including accuracy, Cohen’s kappa coefficient, sensitivity, specificity, precision, F1-score, and balanced accuracy, also using ‘caret’. Finally, we ranked the predictors by their Gini-based importance and focused on the top ten most influential climatic factors. Visualization of confusion-matrix heatmaps and feature-importance bar charts were conducted with ‘ggplot2’.

Based on the feature importance rankings obtained using the RF model, the variables with smaller impacts, such as the relative humidity (Rh), were eliminated. This variable elimination process helped reduce the model’s complexity while retaining the most critical predictive features. Subsequently, a Bayesian hierarchical model was applied to capture the relationships between AFB1 contamination and the selected climate variables, which could address both the spatial dependence and between-province heterogeneity inherent in the data. To address spatial dependence, we adopted an approach conceptually similar to the spatial-error model of Kerry6 and the profile regression framework of Yoo10, and extended it to a county-scale hierarchical Bayesian structure. The hierarchical model offers greater flexibility and adaptability compared with a fixed-effects model76 as its structure allows the inclusion of variables and random effects across multiple levels77. This flexibility enhances the robustness of the model fitting and allows the estimation of the posterior distributions, facilitating more interpretable parameter estimation78,79.

As a result, the model incorporated six key climate variables, including Pre, Tmax, Tmin, Prc, Eva, and Ws. The relationships between AFB1 contamination and the six selected climate variables were modeled as Eqs. 1 and 2:

$${{({AFB}}_{1})}_{i,t}\sim \text{Norm}\left({\mu }_{i,t},{\sigma }_{i}^{2}\right)$$
(1)
$${\mu }_{i,t}\sim \text{Norm}\left(\alpha {0}_{i}+\alpha {1}_{i}{Pre}+\alpha {2}_{i}{{T}_{\max }}_{i,t}+\alpha {3}_{i}{T}_{\min i,t}+\alpha {4}_{i}{{Prc}}_{i,t}+\alpha {5}_{i}{{Eva}}_{i,t}+\alpha {6}_{i}{{Ws}}_{i,t},\sigma {u}_{i,t}^{2}\right)$$
(2)

In the equations, Norm denotes the normal distribution; μ and σ2 are the mathematical expectation and variance, respectively; i denotes the ith province; t denotes the tth year; α0, α1, α2, α3, α4, α5, and α6 are the coefficients of the six predictor variables, and σu2 is the variance of the distribution μ. The tilde (~) denotes Tmin, Tmax, Prc, Pre, Eva and Ws as the minimum temperature, maximum temperature, mean precipitation, mean atmospheric pressure, mean evaporation, and mean wind speed one month before peanut harvest, respectively. Regarding the prior distributions of σi2 and σui, t2 exhibits an inverse gamma distribution.

We assumed that the prior distributions of the coefficients of covariates αk, k = 0, …, 6, to be normal:

$$\alpha k\sim \text{Norm}\left({\beta }_{0},{\sigma }_{\alpha k}^{2}\right)$$
(3)

where β0 is an initial constant (set to 0 in this study), and k represents the kth coefficient. We also assumed that the hyperprior distribution of σαk2 is an inverse gamma distribution.

The posterior distribution of each parameter was estimated using the Markov chain Monte Carlo method80, which was conducted utilizing JAGS and R (version 4.2.3)81.

We ran all the models until reaching convergence, and evaluated the results using trace plot graphs and Gelman-Rubin convergence diagnostic values82. Pointwise log-likelihoods were extracted from the posterior samples generated by the JAGS model, and the LOO-CV analysis was conducted using the loo R package (v2.6.0). The distribution of the diagnostic Pareto k values (Fig. S5a) confirmed that all k < 0.5, indicating stable importance weights and no highly influential observations. Posterior predictive checks (Fig. S5b) demonstrated a close alignment between the simulated predictive distributions and the observed data, validating that the model well fit the underlying data structure. Trace plots of key parameters (Fig. S5c) confirmed effective MCMC mixing and convergence. The strong agreement between predicted and observed values (Fig. S5d), which were distributed tightly around the 1: 1 ideal fitting line, further supported the model’s predictive accuracy. Using this approach, we estimated all the coefficients of the covariates (αk, k=0, …, 6). Fig. S14 to Fig. S19 show the posterior distributions of α\(1\)α6, representing the sensitivity of AFB1 contamination to the corresponding climate variables.

Analysis of future projections

Building on the historical relationship between climate change and AFB1 contamination, the predicted climate variables were utilized to estimate the mean AFB1 levels in each province under the two future scenarios. The climate data outputs from five Earth system models, including MPI-ESM1-2 (Germany), GFDL-ESM4 (USA), IPSL-CM6A-LR (France), MRI-ESM2-0 (Japan), and CAS-ESM2-0 (China), were chosen to ensure regional and institutional diversity and capture a broad range of possible climate responses. They represent different modeling centers from major climate modeling communities across Europe, North America, Asia, and China. All five ESMs are part of the Coupled Model Intercomparison Project Phase 6 (CMIP6) and have been widely validated and used in climate impact assessments. Furthermore, these models provide complete datasets for the required Shared Socioeconomic Pathways (SSP126 and SSP585) at adequate spatial and temporal resolutions, making them suitable for future climate scenario analysis in agricultural contexts. The climatic mean and standard deviation for the month before peanut harvest were calculated for each area (Fig. S20). The data from the five projected climate models were screened as follows. Initially, the peanut sampling sites recorded since 2009 were selected, converted into geographic coordinates, and the future climate data for these coordinates were extracted using a MATLAB program. Subsequently, the average values and standard deviations of the projected climate variables were calculated. This approach allowed estimation of the overall AFB1 level in China during different periods, as well as the changes in historical AFB1 levels across China, which are represented by Eq. 4:

$$\text{Change of}\,{{AFB}}_{r}^{\text{PD}}=\frac{\text{Projected}\,{\text{AFB}}_{1}-\text{Historical}\,{\text{AFB}}_{1}}{\text{Historical}\,{\text{AFB}}_{1}}\times 100 \%$$
(4)

The periods used in the prediction of the AFB1 contamination included the near future (2023–2039), the middle of the century (2040–2069), and the end of the century (2070–2100). Finally, we compared the future projected mean AFB1 contamination with the provincial variations of the mean historical AFB1 contamination.

The relative contribution of climate change to the provincial AFB1 contamination was calculated with Eq. 5:

$$\text{Climate contribution to}\,{\text{AFB}}_{1}=\frac{{\text{Tc}}_{{AFB}}}{{\text{T}}_{{AFB}}}\times 100 \%$$
(5)

where \({\text{Tc}}_{{AFB}}\) is the sensitivity coefficient to the corresponding climatic factor, and \({\text{T}}_{{AFB}}\) is the sum of the absolute value of the actual sensitivity coefficient of AFB1 contamination.

In this study, a Nonlinear Logistic Regression (NLR) model (for the different provinces) was employed to analyze the relationship between the average AFB1 concentration (AFB_aver) and the exceedance rate (AFB_exce). First, the data was organized into a dataset comprising two columns: AFB_exce and AFB_aver. Observations with negative values for the exceedance rate or average concentration were excluded to ensure the validity and accuracy of the data. Model fitting was performed using the nonlinear least squares (NLS) method and Eq. 6:

$${\text{AFB}}_{\text{exce}}=\frac{100}{1+\exp \left(-\left(a+b\times \log \left({AF}{B}_{{aver}}+1\right)\right)\right)}$$
(6)

where the parameters a and b are the intercept and slope of the model, respectively. The initial parameter values were set to a = −4 and b = 0.7 based on preliminary observations of the data trends, ensuring that the model approached an exceedance rate close to 0% at low contamination levels and gradually increased with increasing contamination. An NLR model was chosen for this analysis because the relationship between contamination concentration and exceedance rate is inherently nonlinear and typically exhibits a threshold-like behavior. The S-shaped curve of the logistic function is well-suited for modeling such saturation effects.

Taking Anhui Province as an example, through an iterative optimization process, the model parameters were adjusted and ultimately converged to a ≈ –3.81 and b ≈ 0.55, and the residual sum of square (RSS) was stabilized at 2881.137, indicating successful model convergence.

The model fit was evaluated using multiple indicators, including the statistical significance of the parameters, residual standard error, and correlation coefficient between the predicted and actual values (Fig. S21). The results revealed that both parameters a and b were highly statistically significant (p < 2e-16, Anhui Province; Fig. S21a). The residual standard error was 8.054, and the correlation coefficient reached 0.82 (Table S10), indicating that the model had high explanatory power and prediction accuracy. In addition, visualization of the data through scatter plots of actual data points and the fitted curve further confirmed that the model could appropriately capture the nonlinear relationship in the data.

In this study, to provide a first-order estimate of the total mass of peanuts rendered unusable by AFB1 contamination, we adopted the simplifying assumption that any sample exceeding the national safety threshold is discarded in its entirety. Accordingly, we defined the mass of contaminated peanuts as Eq. 7:

$${\text{Mass}}_{\text{contam}}={{Yield}}_{p}\times \text{AFB\_exce}$$
(7)

Where, \({\text{Mass}}_{\text{contam}}\) is the mass of peanuts deemed unusable due to AFB1 contamination above the safety standard, and \({{Yield}}_{p}\) is the total peanut production. We used the official 2023 peanut production figures published by the National Bureau of Statistics of China for \({{Yield}}_{p}\). The same value was also applied in our projections of future contaminated mass, since we aimed to obtain a broad estimate of the quantity of peanuts that would be downgraded or discarded under elevated AFB1 contamination scenarios.