Skip to content

Panic when using TRY #4321

@mping

Description

@mping

What went wrong?

Earthfile version:
VERSION --try 0.8

Log

Warning: you are not logged into registry-1.docker.io, you may experience rate-limitting when pulling images
Note that the COMMAND keyword will be replaced by FUNCTION starting with VERSION 0.8.
To start using the FUNCTION keyword now (experimental) please use VERSION --use-function-keyword 0.7 in github.com/earthly/lib/Earthfile. Note that switching now may cause breakages for your colleagues if they are using older Earthly versions.
Note that the COMMAND keyword will be replaced by FUNCTION starting with VERSION 0.8.
To start using the FUNCTION keyword now (experimental) please use VERSION --use-function-keyword 0.7 in github.com/earthly/lib/utils/dind/Earthfile. Note that switching now may cause breakages for your colleagues if they are using older Earthly versions.
g/e/l/u/dind+install-dind-script | --> FROM +base
       alpine:3.18.4 | --> Load metadata alpine:3.18.4 linux/amd64
Warning: you are not logged into registry-1.docker.io, you may experience rate-limitting when pulling images
g/e/l/u/dind+install-dind-script | --> FROM alpine:3.18.4
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x10c3439]

goroutine 243 [running]:
github.com/earthly/earthly/earthfile2llb.(*Interpreter).handleTry(0xc000290500, {0x18a56c0, 0xc00139c480}, {{0xc000a2a240, 0x1, 0x1}, 0x0, 0xc000aa67f8, 0xc0008243f0})
        /earthly/earthfile2llb/interpreter.go:507 +0xad9
github.com/earthly/earthly/earthfile2llb.(*Interpreter).handleStatement(0x0?, {0x18a56c0?, 0xc0009803f0?}, {0x0, 0x0, 0x0, 0xc0008243c0, 0x0, 0x0, 0xc000824390})
        /earthly/earthfile2llb/interpreter.go:188 +0x165
github.com/earthly/earthly/earthfile2llb.(*Interpreter).handleBlock(0xc000290500, {0x18a56c0, 0xc0009803f0}, {0xc0004fd880?, 0x10, 0x10})
        /earthly/earthfile2llb/interpreter.go:116 +0x13f
github.com/earthly/earthly/earthfile2llb.(*Interpreter).handleTarget(0xc000290500, {0x18a56f8?, 0xc00071ef50?}, {{0xc00004a5c0, 0x16}, {0x0, 0x0}, {0xc0004fd880, 0x10, 0x10}, ...})
        /earthly/earthfile2llb/interpreter.go:104 +0x15d
github.com/earthly/earthly/earthfile2llb.(*Interpreter).Run(0xc000290500, {0x18a56f8?, 0xc00071ef50}, {0xc00016d7e0, {0xc00016b340, 0x2, 0x2}, {0xc0008ce000, 0x17, 0x20}, ...})
        /earthly/earthfile2llb/interpreter.go:91 +0x245
github.com/earthly/earthly/earthfile2llb.Earthfile2LLB({_, _}, {{0x0, 0x0}, {0x0, 0x0}, {0x188a2a0, 0x1}, {0x0, 0x0}, ...}, ...)
        /earthly/earthfile2llb/earthfile2llb.go:366 +0x1414
github.com/earthly/earthly/builder.(*Builder).convertAndBuild.func3({0x18a56f8, 0xc00016f180}, {0x18ac8d0?, 0xc000700500?})
        /earthly/builder/builder.go:325 +0xb8d
github.com/moby/buildkit/frontend/gateway/grpcclient.(*grpcClient).Run(0xc000700500, {0x18a56f8?, 0xc00016f180}, 0xc00088e7e0)
        /go/pkg/mod/github.com/earthly/[email protected]/frontend/gateway/grpcclient/client.go:215 +0x1ae
github.com/moby/buildkit/client.(*Client).Build.func2({0xc00004a3c1, 0x19}, 0xc000198d00, 0x0?)
        /go/pkg/mod/github.com/earthly/[email protected]/client/build.go:59 +0x3f0
github.com/moby/buildkit/client.(*Client).solve.func3()
        /go/pkg/mod/github.com/earthly/[email protected]/client/solve.go:301 +0x52
golang.org/x/sync/errgroup.(*Group).Go.func1()
        /go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:78 +0x56
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 213
        /go/pkg/mod/golang.org/x/[email protected]/errgroup/errgroup.go:75 +0x96

What should have happened?

This only happens if I use TRY...FINALLY in an unrelated step. No workarounds

What earthly version?

earthly version v0.8.15 cb38f72 linux/amd64; Ubuntu 24.04.2 LTS (Noble Numbat)

Buildkit Logs

No response

Other Helpful Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions