Mod:Creation Kit/Papyrus Runtime Errors

Format of a Runtime Error
A Papyrus runtime error will almost always be structured as follows:

(Error/Warning): stack:

The error text could be one of several errors, of which the most common ones are listed below with explanations. This is followed by a "Stack trace", which is essentially the list of functions that were called (and where) which resulted in the error.

Warning vs. Error
A warning is a condition that the game detects that is probably not what the script writer intended, but which is not an actual error itself. An error is something that prevents proper execution of a script, and is something that the script writer should fix.

Stack Traces
Stack traces essentially pinpoint a location in your script, and the functions that were called, in sequence, to get to that location. They have the following format:

 - "" Line A  - "" Line B  - "" Line C

In the above simplification, Function C was the function or event that the game called. That function, in script file C on line C, called function B. Function B then called function A, and function A in script A on line A, had the error happen.

If one of the functions is a native function, the script file will be listed as " " and the line number will be a question mark.

If debug information is not being loaded (turning on debug info), then all line numbers will be question marks.

Examples
[AMBDustDropDebris (0001E68C)].Sound.Play - " " Line ? [FXdustDropRandomACT (000621D5)].fxDustDropRandomSCRIPT.OnLoad - "fxDustDropRandomSCRIPT.psc" Line 25

In the above stack trace, the error was reported inside the Sound.Play function, which was called on the AMBDustDropDebris (0001E68C) form. Because this function is a native one, the filename is " " and the line number is "?".

This function was called by fxDustDropRandomSCRIPT.OnLoad which, being the function at the bottom of the stack trace, is the event that the game called directly. This function can be found in the "fxDustDropRandomSCRIPT.psc" script, and the call to Play happened on line 25.

Common Warnings
Common general runtime warnings follow, with basic explanations as to their causes and possible solutions. Warnings specific to a certain function are not listed here.

"X does not have a property named Y, property skipped."
This warning appears when an instance of script X is being initialized and the masterfile or plugin provides a value for property Y, but that property does not exist. It usually indicates a script that has been changed, and is now out of date with the plugin. The fix is usually as simple as opening the property window for the script in question and OKing the auto-fixed data.

"Property Y on object X is read-only, property skipped."
This warning appears when an instance of script X is being initialized and the masterfile or plugin provides a value for property Y, but that property is flagged as read-only (It does not have a set function). It usually indicates a script that has been changed, and is now out of date with the plugin. The fix is usually as simple as opening the property window for the script in question and OKing the auto-fixed data.

"The type of property Y on object X does not match the passed-in type at creation, property skipped."
This warning appears when an instance of script X is being initialized and the masterfile or plugin provides a value for property Y, but the type of the plugin or masterfile data doesn't match the property type. It usually indicates a script that has been changed, and is now out of date with the plugin. The fix is to open up the property window for the affected property, and make sure the property is set to a valid value.

"Function X.Y.Z in stack frame A in stack B differs from the in-game resource files - using version from save"
This warning can be emitted during the save game load process. It indicates that function X in state Y in script Z was running at the time of the save, and has been changed since the save was made. The game will use the old version of the function in the save until it exits.

"Function X.Y.Z in stack frame A in stack B doesn't exist in the in-game resource files - using version from save"
This warning can be spit out during the save game load process. It indicates that function X in state Y in script Z no longer exists in the script on disc, but the game was in the middle of the function when the save was made. And so the game will use the version of the function recorded in the save until it exits.

"Unable to get type X referenced by the save game. Objects of this type will not be loaded."
This warning can be emitted during the save game load process and indicates that some objects or type X were saved, but script X no longer exists (or failed to load).

"Type of variable X on script Y, which is Z, doesn't match the type loaded in the actual object. This variable will be skipped."
Another warning that is displayed on save game load and indicates that variable X's type changed between when the save was made and when the save was loaded. Any saved value will be tossed out.

"Variable X on script Y loaded from save not found within the actual object. This variable will be skipped."
This warning is displayed on save game load when variable X in the save no longer exists in the compiled script Y. This variable's value will be tossed out on load.

"Count of X stacks is over our warning threshold, dumping stacks:"
This warning is output to the log when Papyrus thinks it is too busy and there may be runaway scripts. It will be followed by a dump of all running script threads. You should look through the dump for any suspicious behavior, such as several instances of the same script showing up a lot.

Common Errors
Common general runtime errors follow, with basic explanations as to their causes and possible solutions. Errors specific to a certain function are not listed here.

"Cannot call X on a None object, aborting function call"
This error appears when function X, which is non-global, is called on an object variable that is None. Since you cannot call a non-global function on nothing, the call is ignored and the error printed out. If the variable is expected to be None, then you should probably check for None before calling the function on it. Otherwise you should inspect what is going on in the script at that time to see why the variable is None in the first place.

"Unable to call X - no native object bound to the script object, or object is of incorrect type"
This error appears when native function X, which is non-global, is called on an object variable which does not point at an actual object in game. This usually happens in ActiveMagicEffect scripts which can have their effect deleted out from under them, or when calling certain functions on objects in containers.

"Cannot open store for class X, missing file?"
This error appears when the game tries to load a requested script, but the file for it cannot be found. Double-check that the pex file is in the appropriate folder (Data/Scripts).

"Cannot divide by zero"
A division by 0 was attempted, the denominator of a division or modulus operation cannot be 0.

"Assigning None to a non-object variable named X"
An attempt was made to assign the value of "None" to a variable that cannot accept that value. This is usually a result of some previous failed function call to a function that returns a non-object variable, as a failed function call will then return None, and then will attempt to cram that value into the return variable. The 'real' error is usually immediately before this one.

"Array index X is out of range (0-Y)"
An attempt was made to access an array element which does not exist. The element that was attempted to be accessed was X, where the valid range of indices is indicated by 0-Y. Make sure the value being used to index the array is within the range of the array.

"Cannot access an element of a None array"
An attempt was made to access an array element of an array variable that is currently None. Make sure you validate the value of the array before attempting to use it.

"Struct does not have a variable with the name X and so it cannot be searched for"
This error usually shows if a struct's members have been modified, but either the script holding the struct or the script doing the searching is out of date. Re-compiling both should reveal the problem.

"Struct type X does not contain a variable named Y"
This error will show if two scripts are out of date with each other due to the struct's members being modified. Re-compiling both scripts should reveal the issue.

"Overridden function X in object Y does not have the same signature as in parent object Z."
This error may appear while loading a script and indicates that function X, as defined in object Y, does not match object Y's parent's definition (in parent Z). In other words, the return type and/or parameters do not match. This usually means either Y or Z is out of date and needs to be re-compiled.

"Class X found more then once in objects derived from Y - circular inheritance isn't allowed."
This error may appear while loading a script and indicates that somewhere in the inheritance between scripts X and Y there is a circular route. This usually means that X, Y, or some object in between is out of date and needs to be recompiled.

"Stack too deep (infinite recursion likely) - aborting call and returning None"
Too many functions have been called without first returning from them. This usually happens due to infinite recursion in a script, but could also appear in highly complicated scripts that have lots of deep function calls. Try simplifying the script, removing the recursion, and making sure that any recursion has a termination condition.