{"record":{"id":"8ffc5906c01f845e","repo":"windmill-labs/windmill","slug":"server-response-text","errorCode":null,"errorMessage":"<server response text>","messagePattern":"<server response text>","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/dbOps.ts","lineNumber":615,"sourceCode":"export function getDatabaseArg(input: DbInput | undefined) {\n\tif (input?.type === 'database') {\n\t\tif (input.resourcePath.startsWith('datatable://')) {\n\t\t\treturn { database: input.resourcePath }\n\t\t} else {\n\t\t\treturn { database: '$res:' + input.resourcePath }\n\t\t}\n\t}\n\treturn {}\n}\n\nasync function expandMarker(workspace: string, language: string, content: string): Promise<string> {\n\tconst response = await fetch(`/api/w/${workspace}/internal_db/expand_marker`, {\n\t\tmethod: 'POST',\n\t\theaders: { 'Content-Type': 'application/json' },\n\t\tbody: JSON.stringify({ language, content })\n\t})\n\tif (!response.ok) {\n\t\tthrow new Error(await response.text())\n\t}\n\tconst result = (await response.json()) as { code: string }\n\treturn result.code\n}\n","sourceCodeStart":597,"sourceCodeEnd":620,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/dbOps.ts#L597-L620","documentation":"expandMarker() POSTs SQL/Python content to the server's /internal_db/expand_marker endpoint to expand schema markers into full SQL. On any non-OK HTTP response it throws an Error whose message is the raw response body text — so the message text is whatever the server returned (validation error, 500 detail, auth failure, etc.).","triggerScenarios":"The server responds 4xx/5xx to the expand_marker call: malformed content/language payload, marker syntax the server cannot parse, workspace auth failure (401/403), or an internal error while processing the SQL.","commonSituations":"Expired session/token yielding 401; editing a dbOps script with a hand-written marker the backend rejects; server-side bug or DB outage producing a 500; calling from a workspace where internal DB features are unavailable.","solutions":["Read the error message — it is the server's response body and states the actual failure.","If 401/403, re-login or check workspace permissions for internal_db endpoints.","Validate the marker syntax and language field against what the dbOps editor normally generates.","If 500, retry and check server logs; the payload may expose a backend bug worth reporting.","Confirm the backend version supports expand_marker (older backends return 404)."],"exampleFix":"// before\nconst code = await expandMarker(ws, language, content) // throws raw server text\n// after\ntry {\n  const code = await expandMarker(ws, language, content)\n} catch (e) {\n  console.error('expand_marker failed:', e.message) // server response text\n  if (e.message.includes('40')) showToast('Check login and marker syntax')\n  throw e\n}","handlingStrategy":"try-catch","validationCode":"if (!content?.trim()) return '' // nothing to expand\nif (!navigator.onLine) showToast('No network connection')","typeGuard":"function isOkResponse(res: Response): boolean {\n  return res.ok\n}","tryCatchPattern":"try {\n  const code = await expandMarker(ws, language, content)\n} catch (e) {\n  // e.message is the raw server response body\n  if (/401|403|unauthorized/i.test(e.message)) {\n    await relogin()\n  } else {\n    console.error('expand_marker server error:', e.message)\n  }\n  throw e\n}","preventionTips":["Keep session tokens fresh; re-authenticate on 401 before retrying.","Generate markers with the same editor code the backend expects; avoid hand-editing them.","Show the server message verbatim to the user — it names the actual problem.","Watch backend logs for 500s from expand_marker."],"tags":["http","server-error","dbops","network"],"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"}