windmill-labs/windmill · error · Error
No instance found, please add one first
Error message
No instance found, please add one first
What it means
pickInstance resolves which Windmill instance profile the CLI should operate on from locally saved instances. When no instance name can be interactively chosen (allowNew is false) and there are zero saved profiles, it throws this error telling you to add one first.
Source
Thrown at cli/src/commands/instance/instance.ts:240
}
// Try to use the active workspace profile's remote as a fallback
if (instances.length < 1) {
try {
const ws = await getActiveWorkspace({});
if (ws?.remote && ws?.token) {
const remote = ws.remote.endsWith("/") ? ws.remote.slice(0, -1) : ws.remote;
setClient(ws.token, remote);
return {
name: ws.name,
remote: ws.remote,
token: ws.token,
prefix: ws.name,
};
}
} catch { /* ignore */ }
}
if (!allowNew && instances.length < 1) {
throw new Error("No instance found, please add one first");
}
const instanceName = await getActiveInstance(opts);
let instance: Instance | undefined = instances.find(
(i) => i.name === instanceName,
);
if (!instance) {
if (instances.length < 1) {
instance = await addInstance({}, undefined, undefined, undefined);
} else {
const choice = (await Select.prompt({
message: "Select an instance",
options: [
...instances.map((i) => ({
name: `${i.name} (${i.remote})`,
value: i.name,
})),
{ name: "Add new instance", value: "new" },
],View on GitHub (pinned to e474e8803c)
Solutions
- Run 'wmill instance add' and provide the instance URL and token
- In CI, set the required env config or pre-seed the CLI config file before running commands
- Verify you run as the same user/HOME that holds the existing wmill config
- List what the CLI sees with 'wmill instance list' (or equivalent) to confirm the config path
Example fix
// before: command fails because no profile exists wmill whoami // after: register the instance first wmill instance add https://app.windmill.dev <token> --name prod wmill whoami
Defensive patterns
Strategy: validation
Validate before calling
import { allInstances } from "..."; // or check config file
const hasInstance = (await allInstances()).length > 0;
if (!hasInstance) {
throw new Error("Run 'wmill instance add' before this command");
} Try / catch
try {
await wmillInstanceCommand();
} catch (e) {
if (String(e).includes("No instance found")) {
console.error("Register an instance first: wmill instance add <url> <token>");
}
} Prevention
- Run 'wmill instance add' as a first step in new environments/CI images
- Pin the same HOME/user between setup and usage so the config is found
- Seed the CLI config file in container images
- Verify with 'wmill instance list' before scripted runs
When it happens
Trigger: Calling any command that needs an instance config (wmill instance, whoami, getConfig, worker-group pull/push, etc.) on a machine where 'wmill instance add' has never been run, in non-interactive mode where creating a new instance is not allowed.
Common situations: Fresh CI runner or container with no ~/.wmill config; running the CLI under a different user/home than where the instance was added; deleted or missing global settings file.
Related errors
- No local instance profile named ${instanceName}
- No active instance. Run 'wmill instance add' or pass --insta
- Active instance ${activeName} not found in config
- No base branches are configured in wmill.yaml's workspaces s
- Could not resolve parent workspace. Make sure you are in a g
AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03).
Data as JSON: /api/errors/2b487725e92d6d01.
Report an issue: GitHub.