{"record":{"id":"b76ccd0174e12a47","repo":"windmill-labs/windmill","slug":"could-not-pull-resource-types-and-generate-typescr","errorCode":null,"errorMessage":"Could not pull resource types and generate TypeScript namespace: ${error instanceof Error ? error.message : error}","messagePattern":"Could not pull resource types and generate TypeScript namespace: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"cli/src/commands/init/init.ts","lineNumber":262,"sourceCode":"  try {\n    await refreshTsconfig({ yes: opts.useDefault === true });\n  } catch (error) {\n    log.warn(\n      `Could not generate tsconfig: ${\n        error instanceof Error ? error.message : error\n      }`\n    );\n  }\n\n  // Generate resource type namespace (needs a bound workspace)\n  if (didBindWorkspace && boundProfile) {\n    try {\n      // Cache the bound profile so resolveWorkspace doesn't re-resolve and prompt again\n      const rtOpts = { ...opts } as GlobalOptions;\n      (rtOpts as any).__secret_workspace = boundProfile;\n      await generateRTNamespace(rtOpts);\n    } catch (error) {\n      log.warn(\n        `Could not pull resource types and generate TypeScript namespace: ${\n          error instanceof Error ? error.message : error\n        }`\n      );\n    }\n  } else {\n    // generateRTNamespace resolves a workspace; its non-interactive\n    // multiple-workspaces path process.exit(-1)s (uncatchable), aborting init.\n    // So generate only for a single resolvable workspace (baseUrl + matching\n    // profile), passed via __secret_workspace to skip resolution; else skip.\n    const { readConfigFile, getWorkspaceNames, getEffectiveWorkspaceId } =\n      await import(\"../../core/conf.ts\");\n    const config = await readConfigFile({ warnIfMissing: false });\n    const resolvable = getWorkspaceNames(config.workspaces).filter(\n      (n) => !!(config.workspaces as any)?.[n]?.baseUrl\n    );\n    let boundProfileForGen: Workspace | undefined;\n    if (resolvable.length === 1) {","sourceCodeStart":244,"sourceCodeEnd":280,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/init/init.ts#L244-L280","documentation":"When `wmill init` binds a new workspace (didBindWorkspace is true), it immediately pulls the resource types from the backend and generates the TypeScript resource-type namespace via generateRTNamespace. A failure there — network, auth, or codegen — is caught and logged as this warning; init completes without the generated namespace.","triggerScenarios":"`wmill init` with a freshly bound workspace when generateRTNamespace fails: backend unreachable, invalid token, the workspace has no permission to list resource types, or writing the generated namespace file (e.g. backend/windmill-resource-types or similar) fails on disk.","commonSituations":"Token lacks access to resource types on a self-hosted instance; offline environment; workspace bound to a remote whose API version predates the resource-type endpoints; read-only checkout preventing the generated file from being written.","solutions":["Confirm the workspace is reachable and authenticated: `wmill workspace list` then a cheap authenticated call like `wmill user whoami`.","Re-run namespace generation later with the dedicated command (e.g. `wmill resource-type generate-namespace` / re-run `wmill init`) once connectivity is restored.","Verify the token's permissions include reading resource types on that workspace.","If generation keeps failing on write, ensure the target directory is writable and re-run.","Read the warning body for the exact underlying cause (401/403 vs network vs fs error)."],"exampleFix":"// before\nwmill init   # fails to generate namespace; continue manually later\n// after\nwmill init && wmill resource-type generate-namespace   # retry codegen explicitly","handlingStrategy":"try-catch","validationCode":"// verify the bound workspace works before generating the namespace\nconst who = await fetch(`${boundProfile.remote}/api/w/${boundProfile.workspaceId}/workers/queues`, {\n  headers: { Authorization: `Bearer ${boundProfile.token}` },\n});\nif (!who.ok) console.warn(`resource type fetch will fail: HTTP ${who.status}`);","typeGuard":"function hasErrorMessage(error: unknown): error is Error {\n  return error instanceof Error && typeof error.message === \"string\";\n}","tryCatchPattern":"try {\n  await generateRTNamespace(rtOpts);\n} catch (error) {\n  log.warn(`Could not pull resource types and generate TypeScript namespace: ${hasErrorMessage(error) ? error.message : error}`);\n}","preventionTips":["Bind the workspace (`wmill workspace bind`) before init so the token used is current.","Ensure the account has permission to list resource types on the target workspace.","Retry generation with the standalone resource-type namespace command after transient network issues.","Keep CLI and instance versions compatible on self-hosted installs."],"tags":["network","typescript","codegen","cli"],"backgroundTag":"resource-type-fetch-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"}