windmill-labs/windmill · error

${text}

Error message

${text}

What it means

The session's internal HTTP helper reads the response body as text and throws an Error containing the raw body whenever the HTTP status is not ok. The thrown message is therefore whatever the Hub/API returned (HTML error page, JSON error payload, or plain text), used for all POST calls in the deploy-to-Hub flow.

Source

Thrown at frontend/src/lib/components/workspaceSettings/deployToHubSession.svelte.ts:844

			return p
		}
		return {
			fetchItem: (ref) =>
				memoize(this.#previewItemCache, `${ref.kind}:${ref.path}`, () => deps.fetchItem(ref)),
			resolveResourceType: (path) =>
				memoize(this.#previewTypeCache, path, () => deps.resolveResourceType(path))
		}
	}

	async #postHub(path: string, body: unknown): Promise<Record<string, any> | undefined> {
		const res = await fetch(`/api/w/${this.workspace}${path}${this.#folderQs()}`, {
			method: 'POST',
			headers: { 'Content-Type': 'application/json' },
			credentials: 'include',
			body: JSON.stringify(body)
		})
		const text = await res.text()
		if (!res.ok) throw new Error(text)
		try {
			return JSON.parse(text)
		} catch {
			return undefined
		}
	}

	async regenerateMigrations() {
		const tok = ++this.#migrationsTok
		this.migrationsGenerating = true
		try {
			// Same handler-augmented seed as deployAll: a data table used only by a
			// bundled trigger handler must still get its migration.
			const seed: ItemRef[] = [
				...this.selectedItems
					.filter((i) => i.kind !== 'resource')
					.map((i) => ({ kind: i.kind as ItemRef['kind'], path: i.path })),
				...this.#triggerHandlerSeed(this.relevantTriggers, this.hubSlug || 'project')

View on GitHub (pinned to e474e8803c)

Solutions

  1. Read the thrown text — it is the server's own error body and usually names the exact problem (auth, validation, not found)
  2. Check Hub authentication (token/cookie) and that the Hub base URL and project are correct
  3. Retry on 5xx statuses after confirming the Hub is up; for 4xx fix the request payload per the returned error
Defensive patterns

Strategy: try-catch

Validate before calling

// preflight the Hub endpoint and auth
const ping = await fetch(`${hubUrl}/api/...`, { credentials: 'include' })
if (ping.status === 401 || ping.status === 403) throw new Error('Hub authentication invalid before deploy')

Try / catch

try {
  await session.savePipelineRecording()
} catch (e) {
  // e.message is the raw response body — try to parse it
  try { const apiErr = JSON.parse((e as Error).message); handle(apiErr) }
  catch { showRaw((e as Error).message) }
}

Prevention

When it happens

Trigger: Any POST performed by DeployToHubSession (saving recordings, publishing items, etc.) returns a non-2xx status; the entire response body becomes the error message.

Common situations: 401/403 from missing or expired Hub credentials; 404 from a wrong Hub URL/project; 422/400 from a payload the Hub rejects (server-side JSON validation error); 502/503 from Hub downtime.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/71f7e0ef8895c87d. Report an issue: GitHub.