This ḥadīth is singular (gharīb) through this particular chain.
Imām Aḥmad (1) relates: Sulaimān narrated to us; Shuʿbah narrated to us, from Muʿāwiyah ibn Qurrah, from Anas, that while they were digging the trench the Messenger of Allah ﷺ said:
“O Allah, no good is there but the good of the Hereafter, so set right the Ansār and the Muhājirīn.”
Al-Bukhārī and Muslim both include the report in their Ṣaḥīḥs (2) through the narration of Ghundar (3) from Shuʿbah.
Ibn Isḥāq (4) says: “Concerning the excavation of the trench there reached me a number of accounts in which—by Allah’s grace—there is a lesson confirming the truthfulness of the Messenger of Allah ﷺ and establishing his prophethood, something the believers themselves witnessed. One of these is that Jābir ibn ʿAbd Allāh used to relate that a hard rocky ledge (kudiyyah) blocked their digging, so they complained to the Messenger of Allah ﷺ. He called for a vessel of water, spat into it, invoked Allah as He willed, and then sprinkled the water upon that outcrop. Those who were present said, ‘By Him who sent him with the truth, it crumbled until it became like a sandy mound that offered no resistance to pickaxe or shovel.’ Ibn Isḥāq reports this mursal, disconnected from Jābir ibn ʿAbd Allāh (may Allah be pleased with him).
Al-Bukhārī (6) also recorded—may Allah have mercy on him—[that Khallād ibn Yaḥyā narrated to us]: ʿAbd al-Wāḥid ibn Ayman narrated to us, from his father, who said: “I came to Jābir, and he said: ‘On the Day of the Trench we were digging when we hit an exceptionally stubborn rock (kaydah). The people went to the Prophet ﷺ and said, “A boulder blocks the trench.” He replied, “I will go down.” He rose—his stomach bound with a stone—and we had gone three days without tasting food. The Prophet ﷺ took the pickaxe, struck the boulder, and it turned into a heap of soft sand, loose or shifting.
‘I then said, “O Messenger of Allah, allow me to go home.” When I reached my wife I said, “I have seen with the Prophet ﷺ something I cannot bear—have we anything?” She said, “I have some barley and a young goat.” So I slaughtered the kid and ground the barley until we put the meat in the pot. Then I returned to the Prophet ﷺ—the dough had risen and the pot, set between the stones, was nearly done—and I said, “I have a small meal for you, O Messenger of Allah; come with one or two men.”
‘He asked, “How much is it?” I told him, and he said, “It is plentiful and good. Tell her not to remove the pot or the bread from the oven until I arrive.” Then he said, “Rise up!” and the Emigrants and the Helpers all rose with him. When he reached my wife’s house I said to her, “Woe to you, the Prophet ﷺ has come with the Emigrants, the Helpers, and those with them.” She asked, “Did he ask your permission?” I replied…’