windmill-labs/windmill · warning

[SqlTypeService] Worker initialization timeout for ${uri.toS

Error message

[SqlTypeService] Worker initialization timeout for ${uri.toString()}. Custom method not found after ${WORKER_INIT_TIMEOUT}ms

What it means

waitForWorkerInitialization polls the Monaco TypeScript worker for the custom `updateSqlQueries` method used to inject SQL type annotations. If the worker's custom method has not appeared within WORKER_INIT_TIMEOUT (10000ms) of retrying, it throws this timeout error. It signals that the monaco-vscode TypeScript worker either never finished initializing or is not the customized build expected by the SQL type service.

Source

Thrown at frontend/src/lib/components/sqlTypeService.ts:62

	const uri = Uri.parse(modelUri)

	const startTime = Date.now()

	for (let retries = 0; retries < MAX_RETRIES; retries++) {
		try {
			let workerClient = await getWorkerClient()
			await workerClient(uri)
			return true
		} catch (error) {
			if (retries >= 5) {
				console.warn(
					`[SqlTypeService] Worker not ready yet for ${uri.toString()}, retrying... (${
						retries + 1
					}/${MAX_RETRIES})`
				)
			}
			if (Date.now() - startTime > WORKER_INIT_TIMEOUT) {
				throw new Error(
					`[SqlTypeService] Worker initialization timeout for ${uri.toString()}. Custom method not found after ${WORKER_INIT_TIMEOUT}ms`
				)
			}
			await new Promise((resolve) => setTimeout(resolve, RETRY_DELAY))
		}
	}

	throw new Error(
		`[SqlTypeService] Worker initialization failed for ${uri.toString()} after ${MAX_RETRIES} retries.`
	)
}

/**
 * Update SQL query type information in the TypeScript worker
 *
 * This function sends the parsed SQL query details to the custom TypeScript worker,
 * which will then inject type parameters into the code that TypeScript analyzes.
 *

View on GitHub (pinned to e474e8803c)

Solutions

  1. Reload the page so the Monaco worker restarts cleanly, then retry.
  2. Verify the TypeScript worker bundle actually includes the custom updateSqlQueries method (check @codingame/monaco-vscode-standalone-typescript-language-features version/wiring after upgrades).
  3. Increase WORKER_INIT_TIMEOUT/RETRY_DELAY if workers are legitimately slow to boot on target machines.
  4. Check the browser console for earlier worker errors (getWorkerClient logs failures and resets _workerClient) — fix that root error first.
  5. If worker 404s occur only in dev mode, treat as a dev-mode artifact and test in a production build.

Example fix

// before
await waitForWorkerInitialization(modelUri) // throws after 10s
// after
try {
  await waitForWorkerInitialization(modelUri)
} catch {
  console.warn('TS worker not ready for SQL types; skipping type injection')
  return // degrade gracefully — editor still works without SQL annotations
}
Defensive patterns

Strategy: retry

Validate before calling

async function workerReady(modelUri: string): Promise<boolean> {
  try {
    const client = await getWorkerClient()
    const w = await client(Uri.parse(modelUri))
    return typeof (w as any).updateSqlQueries === 'function'
  } catch {
    return false
  }
}

Type guard

function hasSqlMethod(w: TypeScriptWorker): w is ExtendedTypeScriptWorker {
  return typeof (w as any).updateSqlQueries === 'function'
}

Try / catch

try {
  await waitForWorkerInitialization(modelUri)
} catch (e) {
  if (String(e).includes('Worker initialization timeout')) {
    console.warn('SQL type service unavailable; continuing without type injection')
    return
  }
  throw e
}

Prevention

When it happens

Trigger: Calling waitForWorkerInitialization/isTsWorkerInitialization for a model URI while the Monaco TypeScript worker keeps failing to provide the custom method for over 10 seconds (retries every 300ms up to 10 attempts).

Common situations: Slow machines or dev builds where the worker 404s (a known dev-mode artifact); monaco-vscode worker bundle mismatch after dependency upgrades; opening the SQL/asset editor before the worker is ready.

Understand the failure class

Related errors


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