Papyrus Runtime Errors

From the CreationKit Wiki
Revision as of 07:55, 27 September 2016 by imported>JLundin (→‎"Unable to call X - no native object bound to the script object, or object is of incorrect type": Reverting edits which contained incorrect information - and uninstalling mods without rolling back saves is not supported.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Format of a Runtime Error[edit | edit source]

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[edit | edit source]

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[edit | edit source]

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[edit | edit source]

[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[edit | edit source]

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."[edit | edit source]

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."[edit | edit source]

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."[edit | edit source]

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"[edit | edit source]

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"[edit | edit source]

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."[edit | edit source]

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."[edit | edit source]

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."[edit | edit source]

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"[edit | edit source]

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."[edit | edit source]

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[edit | edit source]

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"[edit | edit source]

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"[edit | edit source]

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?"[edit | edit source]

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"[edit | edit source]

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"[edit | edit source]

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)"[edit | edit source]

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"[edit | edit source]

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."[edit | edit source]

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."[edit | edit source]

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"[edit | edit source]

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