windmill-labs/windmill · info
Cannot fetch backend version: no active workspace selected,
Error message
Cannot fetch backend version: no active workspace selected, choose one to pick a remote to fetch version of
What it means
When printing the backend version, main.ts first resolves the active workspace via getActiveWorkspace. If none is selected (or the workspace store is empty/corrupt), it prints this console.warn instead of attempting a fetch, telling the user to select a workspace so it knows which remote to query. It is a usage-state warning, not a network failure.
Source
Thrown at cli/src/main.ts:253
console.log("CLI is up to date");
}
} catch (e) {
console.warn(
`Cannot fetch latest CLI version on npmjs to check if up-to-date: ${e}`
);
}
const workspace = await getActiveWorkspace(opts as GlobalOptions);
if (workspace) {
try {
const backendVersion = await fetchVersion(workspace.remote);
console.log("Backend Version: " + backendVersion);
} catch (e) {
console.warn(
`Cannot fetch backend version from ${workspace.remote} (workspace: ${workspace.name}): ${e}`
);
}
} else {
console.warn(
"Cannot fetch backend version: no active workspace selected, choose one to pick a remote to fetch version of"
);
}
})
.command(
"upgrade",
new UpgradeCommand({
provider: new NpmProvider({ package: "windmill-cli" }),
}).error((e: any) => {
log.error(e);
log.info(
"Try running with sudo and otherwise check the result of the command: npm uninstall windmill-cli && npm install -g windmill-cli"
);
})
)
.command(
"completions",
new Command()View on GitHub (pinned to e474e8803c)
Solutions
- Add a workspace: `wmill workspace add <name> <remote> <token>`.
- Select one: `wmill workspace switch <name>` (or export WMILL_WORKSPACE=<name>).
- In CI, create/select the workspace non-interactively before commands that need it.
- Check ~/.wmill/workspaces.yaml exists and is valid if you believe a workspace was configured.
Example fix
// before wmill version // Cannot fetch backend version: no active workspace selected... // after wmill workspace add prod https://windmill.corp $WMILL_TOKEN wmill workspace switch prod wmill version
Defensive patterns
Strategy: validation
Validate before calling
import { existsSync, readFileSync } from "node:fs";
import { homedir } from "node:os";
const store = `${homedir()}/.wmill/workspaces.yaml`;
if (!existsSync(store)) {
throw new Error("no wmill workspaces configured — run `wmill workspace add <name> <remote> <token>` and `wmill workspace switch <name>`");
} Try / catch
const active = process.env.WMILL_WORKSPACE;
if (!active) {
console.error("set WMILL_WORKSPACE or run `wmill workspace switch <name>` before commands that query the backend");
process.exit(1);
} Prevention
- Persist WMILL_WORKSPACE (or run `wmill workspace switch`) in shell rc and CI setup steps
- Create the workspace non-interactively at the start of CI jobs
- Migrate ~/.wmill/workspaces.yaml when moving machines or containers
- Verify the configured workspace name exists with `wmill workspace list`
When it happens
Trigger: Running the backend-version command (or any flow that reads the active workspace) with no workspace currently selected — never running `wmill workspace add`/`switch`, an unset WMILL_WORKSPACE env, or a missing/corrupt workspaces store.
Common situations: Fresh install of the CLI; CI container with a new $HOME so ~/.wmill/workspaces.yaml doesn't exist; switching machines without migrating workspace credentials; WMILL_WORKSPACE set to a nonexistent name.
Related errors
- App ${appPath} not found
- Dependency generation failed: ${queueResponse.status} ${queu
- Failed to poll dependencies job ${jobId}: ${e?.message ?? e}
- No response body for SSE stream
- Datatable '${dtName}' already exists in this workspace
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/fd4f8fafdeb58dd1.
Report an issue: GitHub.