Skip to content

[Bug]: Quest.getAliases (and other related APIs) fails with an error #2489

Description

@mysticfall

Severity

Critical. A critical defect that causes some key functionality to fail.

Priority

High. Anything that impacts the typical user flow or blocks app usage.

Description

Invoking quest alias-related APIs that return a single object like Quest.getAliasByName, or Quest.getNthAlias always returns null (when their Papyrus counterparts work correctly).

On the other hand, invoking Quest.getAliases results in the following error:

ERROR: TypeError: ctor is not a constructor
    at f (eval at <anonymous> (eval at <anonymous> (unknown source)), <anonymous>:223:34)
    at Actor.methodFinal [as getFactions] (eval at <anonymous> (eval at <anonymous> (unknown source)), <anonymous>:244:18)
    at eval (eval at <anonymous> (unknown source), <anonymous>:55847:35)
    at Generator.next (<anonymous>)
    at eval (eval at <anonymous> (unknown source), <anonymous>:14787:65)
    at effect_internal_function (eval at <anonymous> (unknown source), <anonymous>:1041:12)
    at Object.Iterator (eval at <anonymous> (unknown source), <anonymous>:14787:19)
    at FiberRuntime.Iterator (eval at <anonymous> (unknown source), <anonymous>:15760:38)
    at eval (eval at <anonymous> (unknown source), <anonymous>:15799:31)
    at Object.context (eval at <anonymous> (unknown source), <anonymous>:11178:17)

I suspect other similar APIs that return an array of PapyrusObjects may have the same problem since I can reproduce the error by invoking Actor.getFactions on a valid actor reference as well.

I don't know if it's relevant, but the type definition files (which I believe to be auto-generated) for such functions have imprecise signatures in their return types, e.g. PapyrusObject[] instead of Faction[], for example.

OS

Linux (via Proton GE 10)

OS version

Manjaro KDE

Skyrim version

1.4.15 (VR)

SKSE version

2.0.12 (SKSE VR)

client commit''s hash

cf84e25

server commit''s hash

N/A

Videocard model

RTX 4070 Ti

Steps to reproduce

Run the following test code:

const form = Game.getForm(0x00018b4b) // MS01
const quest = Quest.from(form)

// This prints out "Found the quest: The Forsworn Conspiracy"
printConsole(
    `Found Quest: id=${quest?.getID()}, name=${quest?.getName()}`
)

const firstAlias = quest?.getNthAlias(0)
const namedAlias = quest?.getAliasByName("Eltrys")

if (!firstAlias) {
    // Should never happen:
    printConsole("Failed to get the first alias.")
} else {
    printConsole(
        `First alias: id=${firstAlias.getID()}, name=${firstAlias.getName()}`
    )
}

if (!namedAlias) {
    // Should never happen:
    printConsole("Failed to retrieve a named alias.")
} else {
    printConsole(
        `Named alias: id=${namedAlias.getID()}, name=${namedAlias.getName()}`
    )
}

try {
    const aliases = quest?.getAliases()
    printConsole(`Got ${aliases?.length} aliases.`)
} catch (e) {
    printConsole("Failed to get aliases: " + e.message)
    Debug.traceStack(e.message, 1)
}

Expected result

Expected output from the in-game console:

[Script] Found Quest: id=MS01, name=The Forsworn Conspiracy  
[Script] First alias: id=1, name=Eltrys
[Script] Named alias: id=1, name=Eltrys
[Script] Got 36 aliases.

(Note: I didn't verify the actual ID or the number of aliases using a Papyrus script, but the test script should print out something similar, at least.)

Actual result

In-game console output:

[Script] Found Quest: id=MS01, name=The Forsworn Conspiracy  
[Script] Failed to get the first alias.  
[Script] Failed to retrieve a named alias.  
[Script] !METHOD|Quest.getAliases  
[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null] 

Papyrus log:

ERROR: TypeError: ctor is not a constructor
    at f (eval at <anonymous> (eval at <anonymous> (unknown source)), <anonymous>:223:34)
    at Actor.methodFinal [as getFactions] (eval at <anonymous> (eval at <anonymous> (unknown source)), <anonymous>:244:18)
    at eval (eval at <anonymous> (unknown source), <anonymous>:55847:35)
    at Generator.next (<anonymous>)
    at eval (eval at <anonymous> (unknown source), <anonymous>:14787:65)
    at effect_internal_function (eval at <anonymous> (unknown source), <anonymous>:1041:12)
    at Object.Iterator (eval at <anonymous> (unknown source), <anonymous>:14787:19)
    at FiberRuntime.Iterator (eval at <anonymous> (unknown source), <anonymous>:15760:38)
    at eval (eval at <anonymous> (unknown source), <anonymous>:15799:31)
    at Object.context (eval at <anonymous> (unknown source), <anonymous>:11178:17)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions