{"record":{"id":"71f7e0ef8895c87d","repo":"windmill-labs/windmill","slug":"text","errorCode":null,"errorMessage":"${text}","messagePattern":"\\$\\{text\\}","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/workspaceSettings/deployToHubSession.svelte.ts","lineNumber":844,"sourceCode":"\t\t\treturn p\n\t\t}\n\t\treturn {\n\t\t\tfetchItem: (ref) =>\n\t\t\t\tmemoize(this.#previewItemCache, `${ref.kind}:${ref.path}`, () => deps.fetchItem(ref)),\n\t\t\tresolveResourceType: (path) =>\n\t\t\t\tmemoize(this.#previewTypeCache, path, () => deps.resolveResourceType(path))\n\t\t}\n\t}\n\n\tasync #postHub(path: string, body: unknown): Promise<Record<string, any> | undefined> {\n\t\tconst res = await fetch(`/api/w/${this.workspace}${path}${this.#folderQs()}`, {\n\t\t\tmethod: 'POST',\n\t\t\theaders: { 'Content-Type': 'application/json' },\n\t\t\tcredentials: 'include',\n\t\t\tbody: JSON.stringify(body)\n\t\t})\n\t\tconst text = await res.text()\n\t\tif (!res.ok) throw new Error(text)\n\t\ttry {\n\t\t\treturn JSON.parse(text)\n\t\t} catch {\n\t\t\treturn undefined\n\t\t}\n\t}\n\n\tasync regenerateMigrations() {\n\t\tconst tok = ++this.#migrationsTok\n\t\tthis.migrationsGenerating = true\n\t\ttry {\n\t\t\t// Same handler-augmented seed as deployAll: a data table used only by a\n\t\t\t// bundled trigger handler must still get its migration.\n\t\t\tconst seed: ItemRef[] = [\n\t\t\t\t...this.selectedItems\n\t\t\t\t\t.filter((i) => i.kind !== 'resource')\n\t\t\t\t\t.map((i) => ({ kind: i.kind as ItemRef['kind'], path: i.path })),\n\t\t\t\t...this.#triggerHandlerSeed(this.relevantTriggers, this.hubSlug || 'project')","sourceCodeStart":826,"sourceCodeEnd":862,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/workspaceSettings/deployToHubSession.svelte.ts#L826-L862","documentation":"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.","triggerScenarios":"Any POST performed by DeployToHubSession (saving recordings, publishing items, etc.) returns a non-2xx status; the entire response body becomes the error message.","commonSituations":"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.","solutions":["Read the thrown text — it is the server's own error body and usually names the exact problem (auth, validation, not found)","Check Hub authentication (token/cookie) and that the Hub base URL and project are correct","Retry on 5xx statuses after confirming the Hub is up; for 4xx fix the request payload per the returned error"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// preflight the Hub endpoint and auth\nconst ping = await fetch(`${hubUrl}/api/...`, { credentials: 'include' })\nif (ping.status === 401 || ping.status === 403) throw new Error('Hub authentication invalid before deploy')","typeGuard":null,"tryCatchPattern":"try {\n  await session.savePipelineRecording()\n} catch (e) {\n  // e.message is the raw response body — try to parse it\n  try { const apiErr = JSON.parse((e as Error).message); handle(apiErr) }\n  catch { showRaw((e as Error).message) }\n}","preventionTips":["Refresh Hub credentials/tokens before long export sessions","Validate payloads against the Hub API schema before POSTing","Check Hub availability/health endpoint before batch operations","Log the request URL and status alongside the body for diagnosability"],"tags":["http","api","hub","error-passthrough"],"backgroundTag":"http-error-response","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}