windmill-labs/windmill · error · Error

No workspace selected

Error message

No workspace selected

What it means

signDebugRequest in MonacoDebugger.svelte signs debugger code via /api/w/{workspace}/debug/sign, but it requires an active workspace context. When the `workspace` variable is empty the request cannot even be built, so it throws 'No workspace selected'.

Source

Thrown at frontend/src/lib/components/debug/MonacoDebugger.svelte:344

				envVars[v.name] = v.value
			}
			console.log('[DAP] Parsed env vars:', Object.keys(envVars))
			return envVars
		} catch (error) {
			console.error('Failed to fetch contextual variables:', error)
			return {}
		}
	}

	async function signDebugRequest(
		codeToSign: string,
		lang: string
	): Promise<{
		token: string
		code: string
	}> {
		if (!workspace) {
			throw new Error('No workspace selected')
		}

		const response = await fetch(`/api/w/${workspace}/debug/sign`, {
			method: 'POST',
			headers: { 'Content-Type': 'application/json' },
			body: JSON.stringify({ code: codeToSign, language: lang })
		})

		if (!response.ok) {
			const errorText = await response.text()
			// Parse specific error cases for better user messages
			if (errorText.includes('not initialized')) {
				throw new Error(
					'Debug signing is not configured on the server. Please contact your administrator.'
				)
			}
			throw new Error(errorText || 'Failed to authorize debug session')
		}

View on GitHub (pinned to e474e8803c)

Solutions

  1. Select a workspace before starting a debug session
  2. Wait for the workspace store to hydrate (guard the debug button on a non-empty workspace)
  3. Route to a workspace-scoped URL so `workspace` is defined when the debugger mounts

Example fix

// before
await signDebugRequest(code, lang)
// after
if (!workspace) {
  sendUserToast('Select a workspace before debugging', true)
  return
}
await signDebugRequest(code, lang)
Defensive patterns

Strategy: validation

Validate before calling

if (!workspace) { sendUserToast('Select a workspace first', true); return }
await startDebugging()

Type guard

function hasWorkspace(w: string | undefined | null): w is string { return typeof w === 'string' && w.length > 0 }

Try / catch

try { await startDebugging() } catch (e) { if (e.message === 'No workspace selected') { sendUserToast('Select a workspace first', true) } else { throw e } }

Prevention

When it happens

Trigger: startDebugging is invoked from the Monaco debugger while no workspace is selected — e.g. the debugger is opened in a context (instance-level page, stale store) where the workspace store has not been populated.

Common situations: Opening the debugger before selecting a workspace; workspace store not yet hydrated on first render; deep link into the debugger without a workspace path segment.

Related errors


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