windmill-labs/windmill · warning
Could not generate resource type namespace: ${error instance
Error message
Could not generate resource type namespace: ${error instanceof Error ? error.message : error} What it means
`wmill workspace bind` optionally generates a resource-type namespace after binding a workspace. This is done via a dynamic import of the resource-type module; if that generation throws for any reason, the warning is logged and the bind itself is still considered successful — only the namespace generation failed.
Source
Thrown at cli/src/commands/workspace/workspace.ts:791
log.error(colors.red(`Failed to save configuration: ${(error as Error).message}`));
return;
}
// After a successful bind, offer to generate resource type namespace
if (doBind && isInteractive) {
const { stat: statFile } = await import("node:fs/promises");
const rtExists = await statFile("rt.d.ts").then(() => true, () => false);
const { Confirm } = await import("@cliffy/prompt/confirm");
const generate = await Confirm.prompt({
message: "Generate rt.d.ts? (TypeScript types for your workspace's resource types, useful for autocompletion)",
default: !rtExists,
});
if (generate) {
try {
const { generateRTNamespace } = await import("../resource-type/resource-type.ts");
await generateRTNamespace(opts);
} catch (error) {
log.warn(
`Could not generate resource type namespace: ${
error instanceof Error ? error.message : error
}`
);
}
}
}
}
const command = new Command()
.alias("profile")
.description("workspace related commands")
.action(list as any)
.command("switch")
.complete("workspace", async () => (await allWorkspaces()).map((x) => x.name))
.description("Switch to another workspace")
.arguments("<workspace_name:string:workspace>")
.action(switchC as any)View on GitHub (pinned to e474e8803c)
Solutions
- Re-run namespace generation explicitly: `wmill resource-type generate-namespace` (or the equivalent) after bind succeeds.
- Check your permissions in the bound workspace — you need rights to read/create resource types.
- Reinstall/update the CLI if the dynamic import itself fails (module resolution error).
- Bind without generation, then generate manually once connectivity/permissions are fixed.
Example fix
// before wmill workspace add main https://app.windmill.dev <token> --generate-rt-namespace # warns // after: bind then generate separately with visible errors wmill workspace add main https://app.windmill.dev <token> wmill resource-type generate-namespace
Defensive patterns
Strategy: try-catch
Validate before calling
// verify the module resolves and permissions exist before bind --generate
const mod = await import('../resource-type/resource-type.ts').catch(() => null);
if (!mod) console.error('CLI install broken: resource-type module missing'); Type guard
function hasMessage(e: unknown): e is { message: string } {
return e instanceof Error || (typeof e === 'object' && e !== null && 'message' in e);
} Try / catch
try {
const { generateRTNamespace } = await import('../resource-type/resource-type.ts');
await generateRTNamespace(opts);
} catch (error) {
log.warn(`Could not generate resource type namespace: ${error instanceof Error ? error.message : error}`);
// bind result is still valid; run generation manually to see the full error
} Prevention
- Run generation as a separate explicit step when you need hard failure on namespace creation.
- Ensure the bound user has rights to create resource types in the target workspace.
- Reinstall the CLI if dynamic import errors appear.
- Don't rely on bind for namespace bootstrap in CI scripts.
When it happens
Trigger: Running `wmill workspace bind ... --generate-rt-namespace` (or the equivalent opt-in flag) when generateRTNamespace throws: no default resource types exist, API errors fetching/creating resource types, or the dynamic import path fails in a broken CLI install.
Common situations: Freshly bound workspace with restricted permissions (user cannot create resource types); corrupt/partial CLI install where ../resource-type/resource-type.ts fails to import; network hiccup during resource-type bootstrap.
Related errors
- No git-sync repositories configured in workspace
- Could not fetch schemas for path-based runnables: ${err.mess
- ⚠️ No workspace bound. Sync commands will not work without
- App ${appPath} not found
- Dependency generation failed: ${queueResponse.status} ${queu
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/5838fc6cf60c890e.
Report an issue: GitHub.