{"record":{"id":"d0e80f12e8925e8c","repo":"windmill-labs/windmill","slug":"sqltypeservice-worker-initialization-timeout-for","errorCode":null,"errorMessage":"[SqlTypeService] Worker initialization timeout for ${uri.toString()}. Custom method not found after ${WORKER_INIT_TIMEOUT}ms","messagePattern":"\\[SqlTypeService\\] Worker initialization timeout for (.+?)\\. Custom method not found after (.+?)ms","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"frontend/src/lib/components/sqlTypeService.ts","lineNumber":62,"sourceCode":"\tconst uri = Uri.parse(modelUri)\n\n\tconst startTime = Date.now()\n\n\tfor (let retries = 0; retries < MAX_RETRIES; retries++) {\n\t\ttry {\n\t\t\tlet workerClient = await getWorkerClient()\n\t\t\tawait workerClient(uri)\n\t\t\treturn true\n\t\t} catch (error) {\n\t\t\tif (retries >= 5) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`[SqlTypeService] Worker not ready yet for ${uri.toString()}, retrying... (${\n\t\t\t\t\t\tretries + 1\n\t\t\t\t\t}/${MAX_RETRIES})`\n\t\t\t\t)\n\t\t\t}\n\t\t\tif (Date.now() - startTime > WORKER_INIT_TIMEOUT) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`[SqlTypeService] Worker initialization timeout for ${uri.toString()}. Custom method not found after ${WORKER_INIT_TIMEOUT}ms`\n\t\t\t\t)\n\t\t\t}\n\t\t\tawait new Promise((resolve) => setTimeout(resolve, RETRY_DELAY))\n\t\t}\n\t}\n\n\tthrow new Error(\n\t\t`[SqlTypeService] Worker initialization failed for ${uri.toString()} after ${MAX_RETRIES} retries.`\n\t)\n}\n\n/**\n * Update SQL query type information in the TypeScript worker\n *\n * This function sends the parsed SQL query details to the custom TypeScript worker,\n * which will then inject type parameters into the code that TypeScript analyzes.\n *","sourceCodeStart":44,"sourceCodeEnd":80,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/sqlTypeService.ts#L44-L80","documentation":"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.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Reload the page so the Monaco worker restarts cleanly, then retry.","Verify the TypeScript worker bundle actually includes the custom updateSqlQueries method (check @codingame/monaco-vscode-standalone-typescript-language-features version/wiring after upgrades).","Increase WORKER_INIT_TIMEOUT/RETRY_DELAY if workers are legitimately slow to boot on target machines.","Check the browser console for earlier worker errors (getWorkerClient logs failures and resets _workerClient) — fix that root error first.","If worker 404s occur only in dev mode, treat as a dev-mode artifact and test in a production build."],"exampleFix":"// before\nawait waitForWorkerInitialization(modelUri) // throws after 10s\n// after\ntry {\n  await waitForWorkerInitialization(modelUri)\n} catch {\n  console.warn('TS worker not ready for SQL types; skipping type injection')\n  return // degrade gracefully — editor still works without SQL annotations\n}","handlingStrategy":"retry","validationCode":"async function workerReady(modelUri: string): Promise<boolean> {\n  try {\n    const client = await getWorkerClient()\n    const w = await client(Uri.parse(modelUri))\n    return typeof (w as any).updateSqlQueries === 'function'\n  } catch {\n    return false\n  }\n}","typeGuard":"function hasSqlMethod(w: TypeScriptWorker): w is ExtendedTypeScriptWorker {\n  return typeof (w as any).updateSqlQueries === 'function'\n}","tryCatchPattern":"try {\n  await waitForWorkerInitialization(modelUri)\n} catch (e) {\n  if (String(e).includes('Worker initialization timeout')) {\n    console.warn('SQL type service unavailable; continuing without type injection')\n    return\n  }\n  throw e\n}","preventionTips":["Check the browser console for worker 404s (common dev-mode artifact) before investigating","Keep @codingame/monaco-vscode-* packages version-locked together","Degrade gracefully: SQL type annotation is an enhancement, not a hard requirement","Increase timeout only for known-slow environments; recurring timeouts mean the worker build is broken"],"tags":["web-worker","monaco","timeout","sql"],"backgroundTag":"worker-initialization-timeout","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"}