windmill-labs/windmill · error · Error

Variable not found at ${path} or not visible to you: ${e.bod

Error message

Variable not found at ${path} or not visible to you: ${e.body} ${e}

What it means

`getVariable(path)` in Windmill's runtime client calls `VariableService.getVariableValue` and rethrows any API error with this message. Despite the wording, it covers every failure of the variable lookup — not only a missing variable but also insufficient permission, since variables are permission-scoped and the API hides variables you cannot read.

Source

Thrown at backend/windmill-runtime-nativets/src/windmill-client.js:10087

    });
  } catch (e) {
    if (errorIfNotPossible) {
      throw Error(`Error setting flow user state at ${key}: ${e.body}`);
    } else {
      console.error(`Error setting flow user state at ${key}: ${e.body}`);
    }
  }
}
async function getState() {
  return await getResource(getStatePath(), true);
}
async function getVariable(path) {
  !clientSet && setClient();
  const workspace = getWorkspace();
  try {
    return await VariableService.getVariableValue({ workspace, path });
  } catch (e) {
    throw Error(
      `Variable not found at ${path} or not visible to you: ${e.body} ${e}`
    );
  }
}
async function setVariable(
  path,
  value,
  isSecretIfNotExist,
  descriptionIfNotExist
) {
  !clientSet && setClient();
  const workspace = getWorkspace();
  if (await VariableService.existsVariable({ workspace, path })) {
    await VariableService.updateVariable({
      workspace,
      path,
      requestBody: { value },
    });

View on GitHub (pinned to e474e8803c)

Solutions

  1. Verify the exact variable path (including folder prefix like `u/<user>/` or `f/<folder>/`) in the Windmill UI Variables page of the target workspace.
  2. If the path is correct, check permissions: share the variable's folder with the runner's identity or move it to a folder the script can read.
  3. Read `e.body` from the message to distinguish 404 (missing) from 403 (not visible to you) and fix accordingly.
  4. Create the variable in the target workspace if it only exists in another environment, then retry.

Example fix

// before
const key = await wmill.getVariable('api_key'); // no folder prefix
// after
const key = await wmill.getVariable('u/admin/api_key'); // full path as shown in the UI
Defensive patterns

Strategy: validation

Validate before calling

async function assertVariableExists(path) {
  const vars = await wmill.listVariables();
  return vars.some(v => v.path === path);
}

Try / catch

let value;
try {
  value = await wmill.getVariable(path);
} catch (e) {
  if (/not found|not visible/.test(e.message)) {
    throw new Error(`Variable ${path} missing or unreadable in this workspace: check path and folder permissions`);
  }
  throw e;
}

Prevention

When it happens

Trigger: Calling `wmill.getVariable('u/user/myvar')` (or using `$$var` resolution) when: the variable does not exist at that path; the path is mistyped or missing the folder prefix; the variable lives in another workspace; the caller's token lacks read access to the variable's folder.

Common situations: Typos or wrong case in variable paths; moving a variable between folders without updating scripts; a colleague's script referencing a private variable in `u/<their-username>/`; switching workspaces between local dev and production where the variable was only created in one.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


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