From 5835905fc0b549a077ddbbbe94022d18240ae3cb Mon Sep 17 00:00:00 2001 From: "denis.bilenko" Date: Tue, 17 Nov 2026 07:40:40 +0000 Subject: [PATCH 1/6] direct: treat starting an already-active app as success apply retries DoUpdate on transient errors. When the app start waiter's GET returned 504, the retry sent POST /apps/{name}/start again, and the backend rejected it with 400 because the first start had already brought the compute to ACTIVE. On a 400 from Start, read the app once and continue if its compute is ACTIVE. libs/testserver now rejects a start of an ACTIVE app as the backend does. Co-authored-by: Isaac --- .nextchanges/bundles/app-start-idempotent.md | 1 + bundle/direct/dresources/app.go | 29 +++++++++-- bundle/direct/dresources/app_test.go | 51 ++++++++++++++++++++ libs/testserver/apps.go | 10 ++++ 4 files changed, 86 insertions(+), 5 deletions(-) create mode 100644 .nextchanges/bundles/app-start-idempotent.md diff --git a/.nextchanges/bundles/app-start-idempotent.md b/.nextchanges/bundles/app-start-idempotent.md new file mode 100644 index 00000000000..510ccc69489 --- /dev/null +++ b/.nextchanges/bundles/app-start-idempotent.md @@ -0,0 +1 @@ +* Treat starting an app whose compute is already active as success in the direct deployment engine. A retried deploy after a transient error no longer fails with "Cannot start app ... as its compute is in ACTIVE state". ([#PRNUM](https://github.com/databricks/cli/pull/PRNUM)) diff --git a/bundle/direct/dresources/app.go b/bundle/direct/dresources/app.go index f76681feb98..656cb8f43cc 100644 --- a/bundle/direct/dresources/app.go +++ b/bundle/direct/dresources/app.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "net/http" "slices" "strings" "time" @@ -11,6 +12,7 @@ import ( "github.com/databricks/cli/bundle/appdeploy" "github.com/databricks/cli/bundle/config/resources" "github.com/databricks/cli/bundle/deployplan" + "github.com/databricks/cli/libs/log" "github.com/databricks/cli/libs/structs/structpath" "github.com/databricks/databricks-sdk-go" "github.com/databricks/databricks-sdk-go/apierr" @@ -247,11 +249,7 @@ func (r *ResourceApp) manageLifecycle(ctx context.Context, id string, config *Ap if desiredStarted { // lifecycle.started=true: ensure the app compute is running and deploy the latest code. if !alreadyStarted { - startWaiter, err := r.client.Apps.Start(ctx, apps.StartAppRequest{Name: id}) - if err != nil { - return err - } - startedApp, err := startWaiter.Get() + startedApp, err := r.startApp(ctx, id) if err != nil { return err } @@ -279,6 +277,27 @@ func (r *ResourceApp) manageLifecycle(ctx context.Context, id string, config *Ap return nil } +// startApp starts the app compute and waits for it to become active. A start of an app whose +// compute is already ACTIVE is rejected with 400 BAD_REQUEST ("Cannot start app X as its compute +// is in ACTIVE state"). That happens when apply retries DoUpdate after a transient error in the +// start waiter: the first start already went through, so the app is in the state we want. +func (r *ResourceApp) startApp(ctx context.Context, id string) (*apps.App, error) { + startWaiter, err := r.client.Apps.Start(ctx, apps.StartAppRequest{Name: id}) + if err == nil { + return startWaiter.Get() + } + apiErr, ok := errors.AsType[*apierr.APIError](err) + if !ok || apiErr.StatusCode != http.StatusBadRequest { + return nil, err + } + app, getErr := r.client.Apps.GetByName(ctx, id) + if getErr != nil || app.ComputeStatus == nil || app.ComputeStatus.State != apps.ComputeStateActive { + return nil, err + } + log.Debugf(ctx, "app %s compute is already active, ignoring start error: %s", id, err) + return app, nil +} + // hasAppChanges reports whether the plan entry contains any Update changes // to fields that belong to the App Update API (i.e., not deploy-only fields). func hasAppChanges(entry *PlanEntry) bool { diff --git a/bundle/direct/dresources/app_test.go b/bundle/direct/dresources/app_test.go index 01b619bae21..d25b2278a95 100644 --- a/bundle/direct/dresources/app_test.go +++ b/bundle/direct/dresources/app_test.go @@ -248,3 +248,54 @@ func TestWithMissingServicePrincipalHint(t *testing.T) { assert.Contains(t, got.Error(), `delete it with "databricks apps delete myapp"`) } } + +// A retried DoUpdate starts the app a second time after the first start went through, and the +// backend rejects the second start. Only an ACTIVE compute makes that rejection a success. +func TestAppStartApp_RejectedStart(t *testing.T) { + tests := []struct { + state apps.ComputeState + wantErr bool + }{ + {state: apps.ComputeStateActive, wantErr: false}, + {state: apps.ComputeStateStopped, wantErr: true}, + {state: apps.ComputeStateStarting, wantErr: true}, + {state: apps.ComputeStateDeleting, wantErr: true}, + {state: "", wantErr: true}, + } + for _, tt := range tests { + t.Run(string(tt.state), func(t *testing.T) { + server := testserver.New(t) + startCalls := 0 + server.Handle("POST", "/api/2.0/apps/{name}/start", func(req testserver.Request) any { + startCalls++ + return testserver.Response{ + StatusCode: 400, + Body: map[string]string{ + "error_code": "BAD_REQUEST", + "message": "Cannot start app " + req.Vars["name"] + " as its compute is in ACTIVE state.", + }, + } + }) + server.Handle("GET", "/api/2.0/apps/{name}", func(req testserver.Request) any { + app := apps.App{Name: req.Vars["name"]} + if tt.state != "" { + app.ComputeStatus = &apps.ComputeStatus{State: tt.state} + } + return app + }) + testserver.AddDefaultHandlers(server) + client, err := databricks.NewWorkspaceClient(&databricks.Config{Host: server.URL, Token: "testtoken"}) + require.NoError(t, err) + r := (&ResourceApp{}).New(client) + + app, err := r.startApp(t.Context(), "test-app") + assert.Equal(t, 1, startCalls) + if tt.wantErr { + require.ErrorContains(t, err, "Cannot start app test-app") + return + } + require.NoError(t, err) + assert.Equal(t, apps.ComputeStateActive, app.ComputeStatus.State) + }) + } +} diff --git a/libs/testserver/apps.go b/libs/testserver/apps.go index 29bc70adc2a..ffb020d5a64 100644 --- a/libs/testserver/apps.go +++ b/libs/testserver/apps.go @@ -184,6 +184,16 @@ func (s *FakeWorkspace) AppsStart(_ Request, name string) Response { return Response{StatusCode: 404} } + if app.ComputeStatus != nil && app.ComputeStatus.State == apps.ComputeStateActive { + return Response{ + StatusCode: 400, + Body: map[string]string{ + "error_code": "BAD_REQUEST", + "message": fmt.Sprintf("Cannot start app %s as its compute is in ACTIVE state. App compute needs to be STOPPED to start.", name), + }, + } + } + app.ComputeStatus = &apps.ComputeStatus{ State: apps.ComputeStateActive, Message: "App compute is active.", From 53dbaa30be458db8860e0d88fab8faa6175b9c16 Mon Sep 17 00:00:00 2001 From: "denis.bilenko" Date: Tue, 17 Nov 2026 07:41:14 +0000 Subject: [PATCH 2/6] Add changelog PR number cloud: TestAccept/bundle/resources/apps/lifecycle-started-toggle Co-authored-by: Isaac --- .nextchanges/bundles/app-start-idempotent.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.nextchanges/bundles/app-start-idempotent.md b/.nextchanges/bundles/app-start-idempotent.md index 510ccc69489..0ceafe7518a 100644 --- a/.nextchanges/bundles/app-start-idempotent.md +++ b/.nextchanges/bundles/app-start-idempotent.md @@ -1 +1 @@ -* Treat starting an app whose compute is already active as success in the direct deployment engine. A retried deploy after a transient error no longer fails with "Cannot start app ... as its compute is in ACTIVE state". ([#PRNUM](https://github.com/databricks/cli/pull/PRNUM)) +* Treat starting an app whose compute is already active as success in the direct deployment engine. A retried deploy after a transient error no longer fails with "Cannot start app ... as its compute is in ACTIVE state". ([#7709](https://github.com/databricks/cli/pull/7709)) From 17fb92c11d92ba68804060a1dcd17c053f1a209f Mon Sep 17 00:00:00 2001 From: "denis.bilenko" Date: Tue, 17 Nov 2026 12:16:53 +0000 Subject: [PATCH 3/6] direct: wait for a STARTING app compute after a rejected start A retried start can arrive while the first start is still bringing the compute up. Wait for it to become ACTIVE, as bundle run does, instead of failing with the 400. Add a local acceptance test that loses the first start's response with a 504 after the handler ran, so the retried start reaches the testserver's ACTIVE rejection. Co-authored-by: Isaac --- .nextchanges/bundles/app-start-idempotent.md | 2 +- .../apps/lifecycle-start-retried/app/app.py | 5 ++ .../lifecycle-start-retried/databricks.yml | 11 ++++ .../lifecycle-start-retried/out.test.toml | 2 + .../apps/lifecycle-start-retried/output.txt | 50 +++++++++++++++++++ .../apps/lifecycle-start-retried/script | 20 ++++++++ .../apps/lifecycle-start-retried/test.toml | 4 ++ bundle/direct/dresources/app.go | 22 ++++++-- bundle/direct/dresources/app_test.go | 16 ++++-- 9 files changed, 122 insertions(+), 10 deletions(-) create mode 100644 acceptance/bundle/resources/apps/lifecycle-start-retried/app/app.py create mode 100644 acceptance/bundle/resources/apps/lifecycle-start-retried/databricks.yml create mode 100644 acceptance/bundle/resources/apps/lifecycle-start-retried/out.test.toml create mode 100644 acceptance/bundle/resources/apps/lifecycle-start-retried/output.txt create mode 100644 acceptance/bundle/resources/apps/lifecycle-start-retried/script create mode 100644 acceptance/bundle/resources/apps/lifecycle-start-retried/test.toml diff --git a/.nextchanges/bundles/app-start-idempotent.md b/.nextchanges/bundles/app-start-idempotent.md index 0ceafe7518a..c6829abe913 100644 --- a/.nextchanges/bundles/app-start-idempotent.md +++ b/.nextchanges/bundles/app-start-idempotent.md @@ -1 +1 @@ -* Treat starting an app whose compute is already active as success in the direct deployment engine. A retried deploy after a transient error no longer fails with "Cannot start app ... as its compute is in ACTIVE state". ([#7709](https://github.com/databricks/cli/pull/7709)) +* Treat starting an app whose compute is already active or starting as success in the direct deployment engine. A retried deploy after a transient error no longer fails with "Cannot start app ... as its compute is in ACTIVE state". ([#7709](https://github.com/databricks/cli/pull/7709)) diff --git a/acceptance/bundle/resources/apps/lifecycle-start-retried/app/app.py b/acceptance/bundle/resources/apps/lifecycle-start-retried/app/app.py new file mode 100644 index 00000000000..ad1e64f9fb0 --- /dev/null +++ b/acceptance/bundle/resources/apps/lifecycle-start-retried/app/app.py @@ -0,0 +1,5 @@ +import http.server, os + +http.server.HTTPServer( + ("", int(os.environ["DATABRICKS_APP_PORT"])), http.server.SimpleHTTPRequestHandler +).serve_forever() diff --git a/acceptance/bundle/resources/apps/lifecycle-start-retried/databricks.yml b/acceptance/bundle/resources/apps/lifecycle-start-retried/databricks.yml new file mode 100644 index 00000000000..474b6b99316 --- /dev/null +++ b/acceptance/bundle/resources/apps/lifecycle-start-retried/databricks.yml @@ -0,0 +1,11 @@ +bundle: + name: lifecycle-start-retried + +resources: + apps: + mykey: + name: myapp + description: my_app_description + source_code_path: ./app + lifecycle: + started: false diff --git a/acceptance/bundle/resources/apps/lifecycle-start-retried/out.test.toml b/acceptance/bundle/resources/apps/lifecycle-start-retried/out.test.toml new file mode 100644 index 00000000000..a927a5fbc06 --- /dev/null +++ b/acceptance/bundle/resources/apps/lifecycle-start-retried/out.test.toml @@ -0,0 +1,2 @@ +Cloud = false +EnvMatrix.DMS = ["", "true"] diff --git a/acceptance/bundle/resources/apps/lifecycle-start-retried/output.txt b/acceptance/bundle/resources/apps/lifecycle-start-retried/output.txt new file mode 100644 index 00000000000..faef9fa753b --- /dev/null +++ b/acceptance/bundle/resources/apps/lifecycle-start-retried/output.txt @@ -0,0 +1,50 @@ + +>>> [CLI] bundle deploy +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/lifecycle-start-retried/default/files... +Created apps.mykey +Files: 2 uploaded, 0 deleted +Resources: 1 created, 0 changed, 0 deleted, 0 unchanged + +=== the deploy succeeds, though its start was answered with a 504 + +>>> update_file.py databricks.yml started: false started: true + +>>> [CLI] bundle deploy +Uploading bundle files to /Workspace/Users/[USERNAME]/.bundle/lifecycle-start-retried/default/files... +✓ Deployment succeeded +Updated apps.mykey +Files: 1 uploaded, 0 deleted +Resources: 0 created, 1 changed, 0 deleted, 0 unchanged + +=== start was sent twice; the second was rejected because the compute was already ACTIVE + +>>> print_requests.py //apps ^//api/2.0/bundle --del-body url +{ + "method": "POST", + "path": "/api/2.0/apps/myapp/start", + "body": {} +} +{ + "method": "POST", + "path": "/api/2.0/apps/myapp/start", + "body": {} +} +{ + "method": "POST", + "path": "/api/2.0/apps/myapp/deployments", + "body": { + "mode": "SNAPSHOT", + "source_code_path": "/Workspace/Users/[USERNAME]/.bundle/lifecycle-start-retried/default/files/app" + } +} + +>>> [CLI] apps get myapp +"ACTIVE" + +>>> [CLI] bundle destroy --auto-approve +The following resources will be deleted: + delete resources.apps.mykey + +All files and directories at the following location will be deleted: /Workspace/Users/[USERNAME]/.bundle/lifecycle-start-retried/default + +Destroy: 1 deleted diff --git a/acceptance/bundle/resources/apps/lifecycle-start-retried/script b/acceptance/bundle/resources/apps/lifecycle-start-retried/script new file mode 100644 index 00000000000..b31fc35ad39 --- /dev/null +++ b/acceptance/bundle/resources/apps/lifecycle-start-retried/script @@ -0,0 +1,20 @@ +cleanup() { + trace $CLI bundle destroy --auto-approve + rm -f "$OUT_REQUESTS" +} +trap cleanup EXIT + +trace $CLI bundle deploy +rm -f "$OUT_REQUESTS" + +# Keep the start the handler applied, replace only the response with a 504, so the start +# is sent again while the compute is already ACTIVE. +fault.py --after-handler "POST /api/2.0/apps/*/start" 504 0 1 + +title "the deploy succeeds, though its start was answered with a 504" +trace update_file.py databricks.yml "started: false" "started: true" +trace $CLI bundle deploy + +title "start was sent twice; the second was rejected because the compute was already ACTIVE" +trace print_requests.py //apps '^//api/2.0/bundle' --del-body url +trace $CLI apps get myapp | jq '.compute_status.state' diff --git a/acceptance/bundle/resources/apps/lifecycle-start-retried/test.toml b/acceptance/bundle/resources/apps/lifecycle-start-retried/test.toml new file mode 100644 index 00000000000..51d4c7071ab --- /dev/null +++ b/acceptance/bundle/resources/apps/lifecycle-start-retried/test.toml @@ -0,0 +1,4 @@ +# Local only: the lost response is staged by injecting a fault into the testserver. +Cloud = false +RecordRequests = true +Ignore = [".databricks", "databricks.yml"] diff --git a/bundle/direct/dresources/app.go b/bundle/direct/dresources/app.go index 656cb8f43cc..0de5140fc5b 100644 --- a/bundle/direct/dresources/app.go +++ b/bundle/direct/dresources/app.go @@ -278,9 +278,10 @@ func (r *ResourceApp) manageLifecycle(ctx context.Context, id string, config *Ap } // startApp starts the app compute and waits for it to become active. A start of an app whose -// compute is already ACTIVE is rejected with 400 BAD_REQUEST ("Cannot start app X as its compute +// compute is not STOPPED is rejected with 400 BAD_REQUEST ("Cannot start app X as its compute // is in ACTIVE state"). That happens when apply retries DoUpdate after a transient error in the -// start waiter: the first start already went through, so the app is in the state we want. +// start waiter: the first start already went through, so the compute is ACTIVE, or still +// STARTING if the retry came before it finished. func (r *ResourceApp) startApp(ctx context.Context, id string) (*apps.App, error) { startWaiter, err := r.client.Apps.Start(ctx, apps.StartAppRequest{Name: id}) if err == nil { @@ -291,13 +292,24 @@ func (r *ResourceApp) startApp(ctx context.Context, id string) (*apps.App, error return nil, err } app, getErr := r.client.Apps.GetByName(ctx, id) - if getErr != nil || app.ComputeStatus == nil || app.ComputeStatus.State != apps.ComputeStateActive { + if getErr != nil || app.ComputeStatus == nil { + return nil, err + } + switch app.ComputeStatus.State { + case apps.ComputeStateActive: + log.Debugf(ctx, "app %s compute is already active, ignoring start error: %s", id, err) + return app, nil + case apps.ComputeStateStarting: + log.Debugf(ctx, "app %s compute is already starting, waiting for it instead: %s", id, err) + return r.client.Apps.WaitGetAppActive(ctx, id, appStartTimeout, nil) + default: return nil, err } - log.Debugf(ctx, "app %s compute is already active, ignoring start error: %s", id, err) - return app, nil } +// appStartTimeout matches the SDK's default wait for Apps.Start. +const appStartTimeout = 20 * time.Minute + // hasAppChanges reports whether the plan entry contains any Update changes // to fields that belong to the App Update API (i.e., not deploy-only fields). func hasAppChanges(entry *PlanEntry) bool { diff --git a/bundle/direct/dresources/app_test.go b/bundle/direct/dresources/app_test.go index d25b2278a95..370978e4389 100644 --- a/bundle/direct/dresources/app_test.go +++ b/bundle/direct/dresources/app_test.go @@ -250,15 +250,16 @@ func TestWithMissingServicePrincipalHint(t *testing.T) { } // A retried DoUpdate starts the app a second time after the first start went through, and the -// backend rejects the second start. Only an ACTIVE compute makes that rejection a success. +// backend rejects the second start. An ACTIVE compute makes that rejection a success, and a +// STARTING one is waited for; any other state keeps the error. func TestAppStartApp_RejectedStart(t *testing.T) { tests := []struct { state apps.ComputeState wantErr bool }{ {state: apps.ComputeStateActive, wantErr: false}, + {state: apps.ComputeStateStarting, wantErr: false}, {state: apps.ComputeStateStopped, wantErr: true}, - {state: apps.ComputeStateStarting, wantErr: true}, {state: apps.ComputeStateDeleting, wantErr: true}, {state: "", wantErr: true}, } @@ -276,10 +277,17 @@ func TestAppStartApp_RejectedStart(t *testing.T) { }, } }) + getCalls := 0 server.Handle("GET", "/api/2.0/apps/{name}", func(req testserver.Request) any { + getCalls++ app := apps.App{Name: req.Vars["name"]} - if tt.state != "" { - app.ComputeStatus = &apps.ComputeStatus{State: tt.state} + state := tt.state + // A STARTING compute becomes ACTIVE on the next poll. + if state == apps.ComputeStateStarting && getCalls > 1 { + state = apps.ComputeStateActive + } + if state != "" { + app.ComputeStatus = &apps.ComputeStatus{State: state} } return app }) From 8b079df7ba32ffb447731401e94ffd56b86385f4 Mon Sep 17 00:00:00 2001 From: "denis.bilenko" Date: Wed, 18 Nov 2026 06:20:58 +0000 Subject: [PATCH 4/6] acc: shorten the retry interval in lifecycle-start-retried Each DMS variant waited the default 15s before the retried DoUpdate. Co-authored-by: Isaac --- .../bundle/resources/apps/lifecycle-start-retried/test.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/acceptance/bundle/resources/apps/lifecycle-start-retried/test.toml b/acceptance/bundle/resources/apps/lifecycle-start-retried/test.toml index 51d4c7071ab..2229b4f446b 100644 --- a/acceptance/bundle/resources/apps/lifecycle-start-retried/test.toml +++ b/acceptance/bundle/resources/apps/lifecycle-start-retried/test.toml @@ -2,3 +2,4 @@ Cloud = false RecordRequests = true Ignore = [".databricks", "databricks.yml"] +Env.DATABRICKS_BUNDLE_RETRY_INTERVAL_MS = "100" From 13bcdadbd135ed303d932ecf00adaad37507e793 Mon Sep 17 00:00:00 2001 From: "denis.bilenko" Date: Wed, 18 Nov 2026 13:54:48 +0000 Subject: [PATCH 5/6] direct: keep a failed read after a rejected app start retryable If the GET after a rejected start failed, startApp returned only the start's 400, so apply did not retry a transient read failure (such as a 504). Return the read error, with the 400 as context. Co-authored-by: Isaac --- bundle/direct/dresources/app.go | 7 ++++++- bundle/direct/dresources/app_test.go | 20 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/bundle/direct/dresources/app.go b/bundle/direct/dresources/app.go index 49ca8afda44..c085daf49d1 100644 --- a/bundle/direct/dresources/app.go +++ b/bundle/direct/dresources/app.go @@ -318,7 +318,12 @@ func (r *ResourceApp) startApp(ctx context.Context, id string) (*apps.App, error return nil, err } app, getErr := r.client.Apps.GetByName(ctx, id) - if getErr != nil || app.ComputeStatus == nil { + if getErr != nil { + // Wrap only getErr so that apply's retry sees it: a transient read failure leaves + // the compute state unknown, and the 400 alone would make the failure permanent. + return nil, fmt.Errorf("reading app after start was rejected (%s): %w", err, getErr) + } + if app.ComputeStatus == nil { return nil, err } switch app.ComputeStatus.State { diff --git a/bundle/direct/dresources/app_test.go b/bundle/direct/dresources/app_test.go index c6f5907bc76..faca872d4d6 100644 --- a/bundle/direct/dresources/app_test.go +++ b/bundle/direct/dresources/app_test.go @@ -357,6 +357,26 @@ func TestAppStartApp_RejectedStart(t *testing.T) { } } +// A failed read after a rejected start must stay retryable: the 400 alone is not transient. +func TestAppStartApp_RejectedStartReadFailureIsTransient(t *testing.T) { + server := testserver.New(t) + server.Handle("POST", "/api/2.0/apps/{name}/start", func(req testserver.Request) any { + return appBadRequest("Cannot start app test-app as its compute is in ACTIVE state.") + }) + server.Handle("GET", "/api/2.0/apps/{name}", func(req testserver.Request) any { + return testserver.Response{ + StatusCode: 500, + Body: map[string]string{"error_code": "INTERNAL_ERROR", "message": "boom"}, + } + }) + r := newAppForServer(t, server) + + _, err := r.startApp(t.Context(), "test-app") + require.ErrorContains(t, err, "Cannot start app test-app") + require.ErrorContains(t, err, "boom") + assert.True(t, retry.IsTransient(t.Context(), err)) +} + const ( appComputeUpdatingDeleteMessage = "Cannot delete app test-app as it is not terminal with state UPDATING, " + "and was updated less than 20 minutes ago. Please wait before trying again." From 640da118b3288314187f051f3b140480885a4d4a Mon Sep 17 00:00:00 2001 From: "denis.bilenko" Date: Wed, 18 Nov 2026 16:56:26 +0000 Subject: [PATCH 6/6] direct: format the rejected start error as text for errorlint Co-authored-by: Isaac --- bundle/direct/dresources/app.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundle/direct/dresources/app.go b/bundle/direct/dresources/app.go index c085daf49d1..dec6fea15ce 100644 --- a/bundle/direct/dresources/app.go +++ b/bundle/direct/dresources/app.go @@ -321,7 +321,7 @@ func (r *ResourceApp) startApp(ctx context.Context, id string) (*apps.App, error if getErr != nil { // Wrap only getErr so that apply's retry sees it: a transient read failure leaves // the compute state unknown, and the 400 alone would make the failure permanent. - return nil, fmt.Errorf("reading app after start was rejected (%s): %w", err, getErr) + return nil, fmt.Errorf("reading app after start was rejected (%s): %w", err.Error(), getErr) } if app.ComputeStatus == nil { return nil, err