Resistant error message: "invalid parameter..."

Dear Anyone,
I’ve been working on and running an XCode project for the past year, and - generally - it’s running fine. However, it has now reached the stage where no matter what subroutines or commands I add to it, it refuses to compile properly, with the error:

Uncaught Exception:
Invalid parameter not satisfying: aString != nil

Stack Backtrace:
The stack backtrace has been logged to the console.

For example, if I have the following block:

	tell window "Viewer"
		set position to {DispX, DispY}
	end tell

then the script compiles fine. But if I change it to:


tell window "Viewer"
		set position to {DispX, DispY}
		set image of image view "EEMPic" to load image "ErrorModes.pdf"
	end tell

then when I try to compile, it gives the above error message. Despite this error message on compiling, the program still runs OK, and the image view is appropriately displayed.

Any ideas why this should be? Is it just that my script is now too large (nearly 4000 lines), or is there a flaw buried somewhere in it that I need to find and fix?

Thanks in advance,
PJ.