Automate w/ AppleScript creation of tasks

Dear community
I’m trying to automate task creation with csv import. The structure is Folder/Projects.

I’m unable to get the folder name, is returns folder not found.

AppleScript reads well the csv file, so the problem isn’t there.

anyone can help?

-- Function to split data and handle quotes
on splitData(inputString, delimiter)
	set AppleScript's text item delimiters to delimiter
	set dataItems to text items of inputString
	set AppleScript's text item delimiters to {}
	return dataItems
end splitData

tell application "OmniFocus"
	-- Make sure OmniFocus is active
	activate
	
	-- Data to be processed
	set dataLines to {¬
		"FX;To-Do;Tarefa1;Descricao da Tarefa1;2023-12-01;2023-12-10;Tag1|Tag2;No;Every week;/Users/bruno/Downloads/TemplateCriacaoDeTarefasOMNF.csv|/Users/bruno/Downloads/TemplateCriacaoDeTarefasOMNF.csv", ¬
		"FX;Backlog;Tarefa2;Descricao da Tarefa2;2023-12-01;2023-12-10;;Yes;Every day;/Users/bruno/Downloads/TemplateCriacaoDeTarefasOMNF.csv|/Users/bruno/Downloads/TemplateCriacaoDeTarefasOMNF.csv", ¬
		"FX;Backlog;Tarefa3;;2023-12-01;2023-12-10;Tag1;Yes;Every month;", ¬
		¬
			"FX;Done;Tarefa4;Descricao da Tarefa4;2023-12-01;2023-12-10;Tag1|Tag5|tag2;No;;/Users/bruno/Downloads/Create Projects.applescript"}
	
	-- Iterate over each line of the data
	repeat with i from 1 to count of dataLines
		set currentLine to item i of dataLines
		
		-- Split the line using semicolon as the delimiter
		set taskData to my splitData(currentLine, ";")
		
		-- Ignore lines without enough data
		if (count of taskData) ≥ 10 then
			set folderName to item 1 of taskData
			set projectName to item 2 of taskData
			set taskName to item 3 of taskData
			set taskDescription to item 4 of taskData
			set startDate to item 5 of taskData
			set dueDate to item 6 of taskData
			set taskTags to my splitData(item 7 of taskData, "|")
			set flaggedTask to item 8 of taskData
			set repeatTask to item 9 of taskData
			set attachmentsTask to my splitData(item 10 of taskData, "|")
			
			-- Try to get the folder
			try
				set existingFolder to folder folderName of folder "/Library/Caches/com.omnigroup.OmniFocus3"
			on error
				display dialog "Folder not found: " & folderName
				return
			end try
			
			-- Try to get or create the project within the folder
			try
				set existingProject to project projectName of folders of existingFolder
			on error
				display dialog "Creating a new project: " & projectName
				set existingProject to make new project with properties {name:projectName} at end of projects of existingFolder
			end try
			
			-- Create the task
			set newTask to make new task with properties {name:taskName, note:taskDescription, defer date:startDate, due date:dueDate, flagged:flaggedTask, repetition:repeatTask} at end of tasks of existingProject
			
			-- Add tags to the task
			repeat with eachTag in taskTags
				if eachTag is not equal to "" then
					add tag eachTag to newTask
				end if
			end repeat
			
			-- Add attachments to the task
			repeat with eachAttachment in attachmentsTask
				if eachAttachment is not equal to "" then
					set newAttachment to make new attachment with properties {file name:eachAttachment} at end of attachments of newTask
				end if
			end repeat
		else
			display dialog "Line " & i & " does not contain enough data."
		end if
	end repeat
	
end tell