windmill-labs/windmill · error

No workspace selected

Error message

No workspace selected

What it means

signDebugRequest signs a debug session with the backend by POSTing to /api/w/{workspace}/debug/sign, which creates an audit log entry and returns a signed token. The function requires a non-empty workspace id to build the API path. It throws 'No workspace selected' synchronously when workspace is falsy ('' or undefined), because a debug request cannot be scoped without a workspace.

Source

Thrown at frontend/src/lib/components/debug/debugUtils.ts:56

		return envVars
	} catch (error) {
		console.error('Failed to fetch contextual variables:', error)
		return {}
	}
}

/**
 * Sign a debug request with the backend. This creates an audit log entry
 * and returns a signed token that authorizes the debug session.
 */
export async function signDebugRequest(
	workspace: string,
	code: string,
	language: string
): Promise<{ token: string; code: string; job_id: 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, language })
	})

	if (!response.ok) {
		const errorText = await response.text()
		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. Ensure the workspace is resolved and non-empty before invoking any debug flow (check the workspace store/URL param).
  2. Gate the debug-sign call behind a check like `if (!workspace) return/skip` until workspace context is ready.
  3. Verify the app is not used outside a workspace route (debug signing is workspace-scoped by design).

Example fix

// before
const { token } = await signDebugRequest(workspaceStore.val ?? '', code, language)
// after
if (!workspace) return
const { token } = await signDebugRequest(workspace, code, language)
Defensive patterns

Strategy: validation

Validate before calling

if (!workspace) { /* skip sign or surface 'select a workspace' */ return }

Try / catch

try { const { token } = await signDebugRequest(ws, code, lang) } catch (e) { if ((e as Error).message === 'No workspace selected') promptWorkspaceSelection(); else throw e }

Prevention

When it happens

Trigger: Calling signDebugRequest with an empty-string, null, or undefined workspace argument. In the app this happens when the script/flow editor loads before the workspace is resolved from the URL/store (e.g. direct deep link, workspace store not yet initialized) and the debugger tries to sign its request.

Common situations: Opening an editor page before workspace context hydration completes; embedding the editor in a context that has no workspace selected; a regression where the workspace store is cleared on navigation; calling the utility from custom code without passing the workspace.

Related errors


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