windmill-labs/windmill · error · Error

No active instance. Run 'wmill instance add' or pass --insta

Error message

No active instance. Run 'wmill instance add' or pass --instance.

What it means

When no --instance name is given, resolveInstance falls back to the locally stored active instance. If no active instance is set, it throws this error with the exact remediation: run 'wmill instance add' or pass --instance.

Source

Thrown at cli/src/commands/instance/slack.ts:19

import { colors } from "@cliffy/ansi/colors";
import * as log from "../../core/log.ts";
import { setClient } from "../../core/client.ts";
import * as wmill from "../../../gen/services.gen.ts";
import { getActiveInstance, allInstances, Instance } from "./instance.ts";

async function resolveInstance(
  instanceName: string | undefined
): Promise<Instance> {
  if (instanceName) {
    const match = (await allInstances()).find((i) => i.name === instanceName);
    if (!match) {
      throw new Error(`No local instance profile named ${instanceName}`);
    }
    return match;
  }
  const activeName = await getActiveInstance({});
  if (!activeName) {
    throw new Error(
      "No active instance. Run 'wmill instance add' or pass --instance."
    );
  }
  const match = (await allInstances()).find((i) => i.name === activeName);
  if (!match) {
    throw new Error(`Active instance ${activeName} not found in config`);
  }
  return match;
}

export async function connectSlackInstance(opts: {
  instance?: string;
  botToken: string;
  teamId: string;
  teamName: string;
}) {
  const instance = await resolveInstance(opts.instance);
  setClient(

View on GitHub (pinned to e474e8803c)

Solutions

  1. Run 'wmill instance add' to register and select an instance
  2. Or pass --instance <name> pointing to an existing profile
  3. Verify an active instance exists via 'wmill instance' / whoami before scripting
  4. In CI, bake the instance-add step (or config file) into the setup

Example fix

// before
wmill instance slack sync
// after
wmill instance add https://app.windmill.dev <token>
wmill instance slack sync
// or
wmill instance slack sync --instance prod
Defensive patterns

Strategy: validation

Validate before calling

const active = await getActiveInstance({}); // or 'wmill instance' output
if (!active) {
  console.warn("No active instance; run 'wmill instance add' or pass --instance");
}

Try / catch

try {
  await wmillInstanceSlack({});
} catch (e) {
  if (String(e).includes("No active instance")) {
    console.error("Run 'wmill instance add' first, or pass --instance <name>");
  }
}

Prevention

When it happens

Trigger: Any 'wmill instance slack ...' invocation without --instance on a machine where no active instance has been selected (never added, or active pointer cleared by re-login/config reset).

Common situations: Fresh environment or CI runner without prior 'wmill instance add'; switching machines; another command reset the active instance in the global settings file.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/ea287ebfe99b0cad. Report an issue: GitHub.