{"record":{"id":"ea287ebfe99b0cad","repo":"windmill-labs/windmill","slug":"no-active-instance-run-wmill-instance-add-or-pa","errorCode":null,"errorMessage":"No active instance. Run 'wmill instance add' or pass --instance.","messagePattern":"No active instance\\. Run 'wmill instance add' or pass --instance\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/instance/slack.ts","lineNumber":19,"sourceCode":"import { colors } from \"@cliffy/ansi/colors\";\nimport * as log from \"../../core/log.ts\";\nimport { setClient } from \"../../core/client.ts\";\nimport * as wmill from \"../../../gen/services.gen.ts\";\nimport { getActiveInstance, allInstances, Instance } from \"./instance.ts\";\n\nasync function resolveInstance(\n  instanceName: string | undefined\n): Promise<Instance> {\n  if (instanceName) {\n    const match = (await allInstances()).find((i) => i.name === instanceName);\n    if (!match) {\n      throw new Error(`No local instance profile named ${instanceName}`);\n    }\n    return match;\n  }\n  const activeName = await getActiveInstance({});\n  if (!activeName) {\n    throw new Error(\n      \"No active instance. Run 'wmill instance add' or pass --instance.\"\n    );\n  }\n  const match = (await allInstances()).find((i) => i.name === activeName);\n  if (!match) {\n    throw new Error(`Active instance ${activeName} not found in config`);\n  }\n  return match;\n}\n\nexport async function connectSlackInstance(opts: {\n  instance?: string;\n  botToken: string;\n  teamId: string;\n  teamName: string;\n}) {\n  const instance = await resolveInstance(opts.instance);\n  setClient(","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/instance/slack.ts#L1-L37","documentation":"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.","triggerScenarios":"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).","commonSituations":"Fresh environment or CI runner without prior 'wmill instance add'; switching machines; another command reset the active instance in the global settings file.","solutions":["Run 'wmill instance add' to register and select an instance","Or pass --instance <name> pointing to an existing profile","Verify an active instance exists via 'wmill instance' / whoami before scripting","In CI, bake the instance-add step (or config file) into the setup"],"exampleFix":"// before\nwmill instance slack sync\n// after\nwmill instance add https://app.windmill.dev <token>\nwmill instance slack sync\n// or\nwmill instance slack sync --instance prod","handlingStrategy":"validation","validationCode":"const active = await getActiveInstance({}); // or 'wmill instance' output\nif (!active) {\n  console.warn(\"No active instance; run 'wmill instance add' or pass --instance\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  await wmillInstanceSlack({});\n} catch (e) {\n  if (String(e).includes(\"No active instance\")) {\n    console.error(\"Run 'wmill instance add' first, or pass --instance <name>\");\n  }\n}","preventionTips":["Run 'wmill instance add' during environment bootstrap","Pass --instance explicitly in CI so no active pointer is needed","Check active instance with 'wmill whoami' before scripts","Avoid commands that clear/reset the active instance in shared settings"],"tags":["cli","configuration","slack"],"backgroundTag":"missing-config-profile","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"}