Bug: Finder/AppleScript interaction

I have created a simple AppleScript that makes a folder named with today’s date. For many years, it has worked fine except:

If I run the script (from a script app in the menu bar), then dump files into the folder, then change the colored “Tag” on the folder, I get a Finder error - An unexpected error occurred (error code -8076) - and I have to force-quit the Finder to complete the color tagging.

If it change the tag before dumping the files, no error occurs. (Please hold the “Doctor, it hurts when I do this …” jokes.)

This error has persisted through many macOS major iterations, including Tahoe 26.4.1. Prolly a Finder bug, but not sure.

Here’s the source, for anyone interested.

set dateStr to getDate()
--display dialog dateStr

tell application "Finder"
	activate
	try
		--set thisFolder to (the target of the front window) as alias
		set thisFolder to (the target of the front window) as string
		
		make new folder at thisFolder with properties {name:dateStr as string}
		
	on error errMsg
		display dialog "ERROR: " & errMsg
	end try
	
end tell


on getDate()
	set theDate to current date
	set theYear to year of theDate as string
	set theNewYear to third character of theYear & fourth character of theYear
	
	set theMonth to month of theDate as number as string
	if length of theMonth = 1 then
		set theMonth to "0" & theMonth as string
	end if
	
	set theDay to day of theDate as string
	if length of theDay = 1 then
		set theDay to "0" & theDay as string
	end if
	
	return theNewYear & " " & theMonth & " " & theDay as string
end getDate

{Comment deleted)

Bug: Finder/AppleScript interaction
 
 
Q