{"record":{"id":"640dda63bf5f9e9c","repo":"windmill-labs/windmill","slug":"server-error-text-failed-to-authorize-debug-s","errorCode":null,"errorMessage":"<server error text> || Failed to authorize debug session","messagePattern":"<server error text> \\|\\| Failed to authorize debug session","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/debug/debugUtils.ts","lineNumber":72,"sourceCode":"): Promise<{ token: string; code: string; job_id: string }> {\n\tif (!workspace) {\n\t\tthrow new Error('No workspace selected')\n\t}\n\n\tconst response = await fetch(`/api/w/${workspace}/debug/sign`, {\n\t\tmethod: 'POST',\n\t\theaders: { 'Content-Type': 'application/json' },\n\t\tbody: JSON.stringify({ code, language })\n\t})\n\n\tif (!response.ok) {\n\t\tconst errorText = await response.text()\n\t\tif (errorText.includes('not initialized')) {\n\t\t\tthrow new Error(\n\t\t\t\t'Debug signing is not configured on the server. Please contact your administrator.'\n\t\t\t)\n\t\t}\n\t\tthrow new Error(errorText || 'Failed to authorize debug session')\n\t}\n\n\treturn await response.json()\n}\n\n/**\n * Sign a multiplayer session request. Returns a JWT token that the\n * multiplayer server will verify before accepting the WebSocket connection.\n */\nexport async function signMultiplayerRequest(workspace: string): Promise<string> {\n\tif (!workspace) {\n\t\tthrow new Error('No workspace selected')\n\t}\n\n\tconst response = await fetch(`/api/w/${workspace}/debug/sign_multiplayer`, {\n\t\tmethod: 'POST',\n\t\theaders: { 'Content-Type': 'application/json' },\n\t\tbody: JSON.stringify({})","sourceCodeStart":54,"sourceCodeEnd":90,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/debug/debugUtils.ts#L54-L90","documentation":"signDebugRequest's generic failure path: when POST /api/w/{workspace}/debug/sign returns a non-OK status and the body does not contain 'not initialized', the server's error text (or the fallback 'Failed to authorize debug session' if the body is empty) is thrown verbatim. This is a pass-through of any backend rejection during debug-session signing — auth, permission, or validation errors included.","triggerScenarios":"Any non-2xx from /debug/sign other than the 'not initialized' case: 401/403 (expired token, lacking run permission on the workspace), 404 (workspace or route missing), 400 (invalid code/language payload), 5xx from a proxy, or an empty error body triggering the fallback message.","commonSituations":"User token expired or lacks debugger permissions; workspace deleted/renamed; reverse proxy returning an HTML error page (502/503) with no useful text; backend down; payload rejected because the language string is misspelled.","solutions":["Inspect the thrown message and the corresponding network response status in devtools to identify the backend rejection.","For 401/403: re-login or request debugger/run permissions on the workspace, then retry.","For 404: confirm the workspace id and that the backend version supports /debug/sign.","For 5xx/empty bodies: check backend/proxy logs; retry once the server is healthy."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { await signDebugRequest(ws, code, lang) } catch (e) { toast(getDebugErrorMessage(e)); console.warn('debug sign failed', e) }","preventionTips":["Refresh auth tokens before long-lived editor sessions issue signed requests.","Verify workspace membership/permissions before offering debug actions.","Handle empty server error bodies by always wrapping with getDebugErrorMessage()."],"tags":["network","http","debugging","authorization"],"backgroundTag":"http-request-failed","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"}