Papyrus Runtime Errors

Revision as of 12:01, 13 November 2012 by imported>JLundin (→‎Common Errors)

Format of a Runtime Error

A Papyrus runtime error will almost always be structured as follows:

(Error/Warning): <error text>
stack:
  <stack trace>

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:

<Function A> - "<script file A>" Line A
<Function B> - "<script file B>" Line B
<Function C> - "<script file C>" 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 "<native>" 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() - "<native>" 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 "<native>" 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.

"Property X on script Y attached to <Form ID> cannot be initialized because the script no longer contains that property"

This warning is displayed when a script is being initialized, and property X has an assigned value in the masterfile or plugin, but no longer exists in the compiled script Y attached to <Form ID>. This indicates that a script has been changed, but the value of the property was not cleared in the Property dialog. When a property has been assigned a value in the Creation Kit, deleting the property from a script and recompiling it does not immediately remove the property from the plugin. The plugin must be saved, then the Creation Kit should be closed and re-opened and the plugin reloaded. This problem can also be fixed by opening the script Property dialog and selecting "Clear Value" next to that property.

"(Ref ID): Ref is in an unloaded cell, so it cannot cast spells."

This warning is displayed when the functions Cast or RemoteCast are called by a reference that is in an unloaded cell. Check that the object's parent cell has loaded before calling these functions. If you still get these errors after testing that the cell is loaded, then try adding a Wait call to the script to give the object or its environment sufficient time to fully initialize and load before attempting to call the Cast or RemoteCast functions.

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. See My_Script_Doesn't_Work for some possibilities.

In the example below, the placement of a dummy marker failed, so the variable pointing at the marker had a value of None.

[09/29/2012 - 08:22:05PM] error: Cannot call MoveToNode() on a None object, aborting function call
stack:
	[ (FF000E50)].critterMoth.PlaceDummyMarker() - "Critter.psc" Line 351
	[ (FF000E50)].critterMoth.BellShapeTranslateToRefAtSpeed() - "Critter.psc" Line 575
	[ (FF000E50)].critterMoth.BellShapeTranslateToRefNodeAtSpeedAndGotoState() - "Critter.psc" Line 641
	[ (FF000E50)].critterMoth.GoToNewPlant() - "CritterMoth.psc" Line 278
	[ (FF000E50)].critterMoth.OnUpdate() - "CritterMoth.psc" Line 138

The code at line 351 of "Critter.psc" script, which caused the error was:

dummyMarker.MoveToNode(arTarget, asTargetNode)

The error is generated because it is not possible to call function MoveToNode on None.

"Unable to call X - no native object bound to the script object, or object is of incorrect type"

This error appears when the ObjectReference that the script is attached to, or the ObjectReference's base form, can no longer be found by the script. There are various scenarios that can cause this problem. Some examples and possible solutions are:

- the plugin was upgraded and the new plugin file no longer has this base form, or the form ID has changed. The savegame is still trying to reference the old form. The solution may be to follow the plugin author's "clean save" procedure before upgrading the plugin.
- you disabled the plugin but haven't uninstalled the plugin's loose scripts (if any). The solution is to remove the plugin's loose scripts from the Skyrim "data/scripts" folder.
- a bad savegame read, where somehow data has become corrupted while the savegame was being loaded. Try restarting Skyrim and reloading your savegame. This often fixes the problem.
- savegame corruption. Try loading an earlier save and see if the problem is resolved.

Note that these errors don't necessarily mean that the plugin or script that is generating the errors was responsible for any savegame corruption. It simply means that the plugin is being adversely affected by the corrupted data.

[09/29/2012 - 09:37:49PM] error: Unable to call GetPositionZ - no native object bound to the script object, or object is of incorrect type
stack:
	[<NULL form> (FF000C6E)]._TestScript.GetPositionZ() - "<native>" Line ?
	[<NULL form> (FF000C6E)]._TestScript.Z() - "ObjectReference.psc" Line 136
	[<NULL form> (FF000C6E)]._TestScript.MainFunction() - "_TestScript.psc" Line ?
	[<NULL form> (FF000C6E)]._TestScript.InitScript() - "_TestScript.psc" Line 199
	[<NULL form> (FF000C6E)]._TestScript.OnUpdate() - "_TestScript.psc" Line 165

This error also appears if you try to access the native functions on an ActiveMagicEffect that has been dispelled. The problem usually arises when you try to call functions in OnEffectFinish. Note that events such as OnUpdate are automatically unregistered for active magic effects, so no need to call UnregisterForUpdate for example.

"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.

"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.

"Unable to bind script <script name> to <Form ID> because their base types do not match"

This can mean that either the script is missing (in which case you will see a failed to load error before this one) or the script cannot be attached to the type of object it is attached to. (Like trying to attach a script that extends ObjectReference to an alias)


Language: English  • français