windmill-labs/windmill · error · Error

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

Error message

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

What it means

This library's resource getter calls the Windmill API and, when the requested path returns HTTP 404, throws a generic Error combining the path and the API response body. The library only swallows the 404 if the caller passed undefinedIfEmpty=true; otherwise it re-throws with this message. It means the resource path does not exist in the workspace or the current token lacks visibility into it.

Source

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

  return window.process.env[key];
};
function getWorkspace() {
  return getEnv("WM_WORKSPACE") ?? "no_workspace";
}
async function getResource(path, undefinedIfEmpty) {
  !clientSet && setClient();
  const workspace = getWorkspace();
  path = path ?? getStatePath();
  try {
    return await ResourceService.getResourceValueInterpolated({
      workspace,
      path,
    });
  } catch (e) {
    if (undefinedIfEmpty && e.status === 404) {
      return void 0;
    } else {
      throw Error(
        `Resource not found at ${path} or not visible to you: ${e.body}`
      );
    }
  }
}
async function getRootJobId(jobId) {
  !clientSet && setClient();
  const workspace = getWorkspace();
  jobId = jobId ?? getEnv("WM_JOB_ID");
  if (jobId === void 0) {
    throw Error("Job ID not set");
  }
  return await JobService.getRootJobId({ workspace, id: jobId });
}
async function runScript(
  path = null,
  hash_ = null,
  args = null,

View on GitHub (pinned to e474e8803c)

Solutions

  1. Verify the exact resource path exists in the Windmill UI (Resources page) in the workspace your token targets
  2. Pass undefinedIfEmpty=true if a missing resource should yield undefined instead of throwing
  3. Check WM_WORKSPACE / token workspace matches where the resource lives
  4. Create the resource or fix the path prefix (u/<user>/..., f/...)
  5. Grant the caller's group/token permission to see the resource

Example fix

// before
const r = await getResource('my_resource'); // throws if missing
// after
const r = await getResource('my_resource', undefined, true); // undefinedIfEmpty=true -> returns undefined
Defensive patterns

Strategy: fallback

Validate before calling

const exists = typeof path === 'string' && path.length > 0;
if (!exists) throw new Error('resource path required before lookup');

Type guard

function hasBody(e) { return e && typeof e.body === 'string' && e.status !== undefined; }

Try / catch

let resource;
try {
  resource = await getResource(path);
} catch (e) {
  if (String(e.message).includes('Resource not found')) resource = undefined;
  else throw e;
}

Prevention

When it happens

Trigger: Calling the generated resource-get function (e.g. getResource/getResourceViaPath) with a path that has no resource in the workspace, while undefinedIfEmpty is falsy. Also occurs when the token's workspace or permission masks an existing resource, so the API answers 404.

Common situations: Typo in the resource path or wrong folder prefix (u/<user>/ vs f/); resource created in a different workspace than WM_WORKSPACE points to; using state-related getters where WM_STATE_PATH was never initialized; deleted or renamed resource; running with a token lacking group access to the resource.

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/6b8de67e6ef52057. Report an issue: GitHub.