Two pieces of AppleScript: one works, one fails—why?

tell application "Script Editor"
	display dialog "Enter the link date as DD/MM/YYYY" default answer "01/07/2021"
		--> {button returned:"OK", text returned:"31/05/2021"}
end tell
tell application "DEVONthink 3"
	open database "/Users/stapp/Documents/DevonThink/Diaries.dtBase2"
		--> database id 3
	search "name:Monday 31 May 2021.md"
		--> {}
Result:
error "Can’t get item 1 of {}." number -1728 from item 1 of {}

Stephen