#Engine crash on a nil return

1 messages · Page 1 of 1 (latest)

vague thicket
#

I am unsure if this has always been the same behaviour. But it does not feel right that the engine crashes when a expected return core type (e.g. dagger.Direcotry) is nil
Reproducible example:

func (m *Test) Test() (*dagger.Directory, error) {
    return nil, nil
}

Call the function:

dagger call test

See the engine die 😄
Logs from the engine

time="2025-09-15T13:20:46Z" level=warning msg="CoreModObject.ConvertFromSDKResult: got nil value"
time="2025-09-15T13:20:46Z" level=debug msg="function call done" client_hostname=G27H4H2CNV client_id=u8wivtrp2cslodheqbi82wprf function=something module=test object=Test session_id=h9njd72hh492rfcpxm7stacvr spanID=918193a10e81e665 traceID=3e523497cf917b5f96e61c19f8dca3ee
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x50 pc=0x15b7b94]

goroutine 77400 [running]:
github.com/dagger/dagger/core.(*ModuleFunction).Call(0x4000551b20, {0x32b6130, 0x40031ad4f0}, 0x40044e9c70)
        /app/core/modfunc.go:528 +0x1b04
github.com/dagger/dagger/core.objFun.func1({0x32b6130, 0x40031ad4f0}, {{0x4002895280, 0x4003f2f128, 0x0}, {0x4002de3890, 0x1, 0x4002e24000, 0x4002d769a8, 0x4002e1a570}}, ...)
        /app/core/object.go:503 +0x220
github.com/dagger/dagger/dagql.Class[...].Call(0x3326560, {0x32b6130, 0x40031ad4f0}, 0x1?, {{0x4002895280, 0x4003f2f128, 0x0}, {0x4002de3890, 0x1, 0x4002e24000, ...}}, ...)
        /app/dagql/objects.go:302 +0xd4
github.com/dagger/dagger/dagql.ObjectResult[...].call.func2()
        /app/dagql/objects.go:670 +0x8c
github.com/dagger/dagger/engine/cache.(*cache[...]).GetOrInitializeWithCallbacks.func1()
        /app/engine/cache/cache.go:210 +0x58
created by github.com/dagger/dagger/engine/cache.(*cache[...]).GetOrInitializeWithCallbacks in goroutine 77399
        /app/engine/cache/cache.go:208 +0x5b0
#

v0.18.17

#

I tend to come here before filling up a bug report, to confirm I am not doing anything stupid 😉

twilit ether
urban yew
#

fyi @scenic grotto

#

think this is logic you've touched recently with result?

scenic grotto