#Dagger Run hiding some errors in tty vs plain mode

1 messages · Page 1 of 1 (latest)

nocturne mason
#

I keep having to re-run builds and turn on plain output to see errors. Is there some way to fix this?

# tony @ hydrogen in ~/hof/hof/lib/env/devex on git:_next x [15:21:54] 
$ dagger run hof env run hack.dev                  
✔ connect 0.2s

Setup tracing at https://dagger.cloud/traces/setup. To hide set DAGGER_NO_NAG=1

vs

# tony @ hydrogen in ~/hof/hof/lib/env/devex on git:_next x [15:37:10] C:1
$ dagger run --progress plain  hof env run hack.dev
1   : connect
1   : [0.0s] | cloud url=https://dagger.cloud/traces/setup
2   : ┆ starting engine
3   : ┆ ┆ create container
4   : ┆ ┆ ┆ exec docker ps -a --format {{.Names}}
4   : ┆ ┆ ┆ [0.1s] | dagger-engine-v0.19.8
4   : ┆ ┆ ┆ [0.1s] | veg-dagger-engine
4   : ┆ ┆ ┆ [0.1s] | veg-registry
4   : ┆ ┆ ┆ exec docker ps -a --format {{.Names}} DONE [0.1s]
5   : ┆ ┆ ┆ exec docker start dagger-engine-v0.19.8
5   : ┆ ┆ ┆ [0.0s] | dagger-engine-v0.19.8
5   : ┆ ┆ ┆ exec docker start dagger-engine-v0.19.8 DONE [0.0s]
3   : ┆ ┆ create container DONE [0.1s]
2   : ┆ starting engine DONE [0.1s]
6   : ┆ connecting to engine
6   : ┆ connecting to engine DONE [0.0s]
7   : ┆ starting session
6   : ┆ connecting to engine DONE [0.0s]
6   : ┆ [0.0s] | 15:37:21 INF connected name=819364b035ad client-version=v0.19.8 server-version=v0.19.8
7   : ┆ starting session DONE [0.2s]
1   : connect DONE [0.4s]

WARN - failures detected while emitting telemetry. trace information incomplete
(failed to upload metrics: Post "https://api.dagger.cloud/v1/metrics": context canceled)


Setup tracing at https://dagger.cloud/traces/setup. To hide set DAGGER_NO_NAG=1


stdout err: failed to find env "hack.dev"failed to find env "hack.dev"
stderr err: failed to find env "hack.dev"
nocturne mason
#

Narrowed the bug down to frontend_pretty.go:505

    if fe.err != nil && fe.shell == nil {
        fmt.Println("GET HERE:", fe.err)
        if fe.hasShownRootError() {
            fmt.Println("got here too")
            renderPrimaryOutput(w, fe.db)
            // If we've already shown the root cause error for the command, we can
            // skip displaying the primary output and error, since it's just a poorer
            // representation of the same error (`Error: input: ...`)
            var exitErr ExitError
            if errors.As(fe.err, &exitErr) {
                return exitErr
            }
            return ExitError{Code: 1, Original: fe.err}
        }
    }
#
$ hof env run hack.dev
▶ ✔ connect 0.2s

✔ connect 0.2s
GET HERE: exit status 1
got here too

failed to find env "hack.dev"
while running incept: exit code 1
#

Seems it thinks it has already renderd the root error when it has not

#

Patch which appears to fix it

diff --git a/dagql/idtui/frontend_pretty.go b/dagql/idtui/frontend_pretty.go
index 867bb9554..48eccb612 100644
--- a/dagql/idtui/frontend_pretty.go
+++ b/dagql/idtui/frontend_pretty.go
@@ -2166,6 +2166,11 @@ func (fe *frontendPretty) hasShownRootError() bool {
        if fe.err == nil {
                return false
        }
+       terrs := telemetry.ParseErrorOrigins(fe.err.Error())
+       if len(terrs) == 0 {
+               // some error outside of our purview, should probably print
+               return false
+       }
        for _, origin := range telemetry.ParseErrorOrigins(fe.err.Error()) {
                if !origin.IsValid() {
                        return false

ornate moth
ornate moth
nocturne mason
#

there error is outside of dagger

  1. connect to dagger
  2. trigger error reading a cue file
  3. no calls to dagger engine yet
#

as a reminder/context, we use Dagger via the Go SDK, no dagger modules or functions