Error when sending POSIX file as attachment with iMessage
You are running into AppleScript sandboxing. The Messages application does not have access to open that file.  The trick is to turn the paths to POSIX files outside of the tell blocks. This will let the entitlement engine pass the entitlement into the tell block so the application can open it.  

This code works:

tell application "System Events"
    set paths to POSIX path of disk items of folder "~/Desktop/my-folder"
end tell

set imgs to {}
repeat with f in paths
    set imgs to imgs &amp; (POSIX file f)
end repeat

tell application "Messages"
    set targetServiceId to id of 1st service whose service type = iMessage
    set theBuddy to buddy "redacted" of service id targetServiceId
    repeat with img in imgs
        send img to theBuddy
    end repeat
end tell