diff --git a/backend/windmill-api-workspaces/src/workspaces.rs b/backend/windmill-api-workspaces/src/workspaces.rs index 046530def8..44f686ad58 100644 --- a/backend/windmill-api-workspaces/src/workspaces.rs +++ b/backend/windmill-api-workspaces/src/workspaces.rs @@ -2546,10 +2546,18 @@ async fn run_datatable_migration_job( let (result, success) = run_wait_result_internal(db, uuid, w_id, None, false, &authed.username).await?; if !success { - return Err(Error::internal_err(format!( - "migration job failed: {}", - result.get() - ))); + // On failure the job result is `{"error": {"name", "message", ...}}`; + // surface the executor's message (the Postgres error, e.g. `relation + // "foo" does not exist`) instead of the raw JSON envelope. + let detail = serde_json::from_str::(result.get()) + .ok() + .as_ref() + .and_then(|v| v.get("error")) + .and_then(|e| e.get("message")) + .and_then(|m| m.as_str()) + .map(str::to_string) + .unwrap_or_else(|| result.get().to_string()); + return Err(Error::internal_err(detail)); } Ok(()) } diff --git a/cli/src/commands/sync/sync.ts b/cli/src/commands/sync/sync.ts index b7e70ae8df..19516d84d5 100644 --- a/cli/src/commands/sync/sync.ts +++ b/cli/src/commands/sync/sync.ts @@ -4999,8 +4999,10 @@ export async function push( yes: opts.yes, jsonOutput: opts.jsonOutput, }); - } catch (e) { - log.warn(`Failed to run new datatable migrations: ${e}`); + } catch (e: any) { + log.warn( + `Failed to run new datatable migrations: ${e?.body ?? e?.message ?? e}`, + ); } if (opts.jsonOutput) { const result = {