windmill-labs/windmill · error

Unauthorized: Could not authenticate with the provided…

Error message

Unauthorized: Could not authenticate with the provided credentials

What it means

requireLogin got an HTTP 401/403-class response from the whoami call: the token (--token, stored login, or workspace token) is invalid, expired, or scoped to the wrong instance, so authentication cannot proceed and the CLI exits.

Solutions

  1. Regenerate the token in the Windmill UI and pass it via --token.
  2. Re-run `wmill login` to refresh stored credentials.
  3. Confirm --base-url points at the instance the token was issued for.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at cli/src/core/auth.ts:130 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


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

Appendix: source

Thrown at cli/src/core/auth.ts:130

            `Could not authenticate with the provided credentials. Please check your --token and --base-url and try again.${bodyStr ? `\n${bodyStr}` : ""}`
          ));
        } else {
          log.infoStderr(colors.red(
            `Request failed (${status ?? "unknown"}): ${bodyStr}`
          ));
        }
        return process.exit(1);
      }
      log.infoStderr(colors.red("Could not authenticate with the provided credentials. Please check your --token and --base-url and try again."));
      return process.exit(1);
    }

    log.infoStderr(
      "! Could not reach API given existing credentials. Attempting to reauth..."
    );
    const newToken = await loginInteractive(workspace.remote);
    if (!newToken) {
      throw new Error("Unauthorized: Could not authenticate with the provided credentials");
    }

    // Update workspace token
    const { removeWorkspace, addWorkspace } = await import("../commands/workspace/workspace.ts");
    removeWorkspace(workspace.name, false, opts);
    workspace.token = newToken;
    addWorkspace(workspace, opts);

    setClient(
      newToken,
      workspace.remote.substring(0, workspace.remote.length - 1)
    );
    return await fetchWhoami(workspace.workspaceId);
  }
}

View on GitHub (pinned to e474e8803c)