{"record":{"id":"6b8de67e6ef52057","repo":"windmill-labs/windmill","slug":"resource-not-found-at-path-or-not-visible-to-yo","errorCode":null,"errorMessage":"Resource not found at ${path} or not visible to you: ${e.body}","messagePattern":"Resource not found at (.+?) or not visible to you: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"backend/windmill-runtime-nativets/src/windmill-client.js","lineNumber":9876,"sourceCode":"  return window.process.env[key];\n};\nfunction getWorkspace() {\n  return getEnv(\"WM_WORKSPACE\") ?? \"no_workspace\";\n}\nasync function getResource(path, undefinedIfEmpty) {\n  !clientSet && setClient();\n  const workspace = getWorkspace();\n  path = path ?? getStatePath();\n  try {\n    return await ResourceService.getResourceValueInterpolated({\n      workspace,\n      path,\n    });\n  } catch (e) {\n    if (undefinedIfEmpty && e.status === 404) {\n      return void 0;\n    } else {\n      throw Error(\n        `Resource not found at ${path} or not visible to you: ${e.body}`\n      );\n    }\n  }\n}\nasync function getRootJobId(jobId) {\n  !clientSet && setClient();\n  const workspace = getWorkspace();\n  jobId = jobId ?? getEnv(\"WM_JOB_ID\");\n  if (jobId === void 0) {\n    throw Error(\"Job ID not set\");\n  }\n  return await JobService.getRootJobId({ workspace, id: jobId });\n}\nasync function runScript(\n  path = null,\n  hash_ = null,\n  args = null,","sourceCodeStart":9858,"sourceCodeEnd":9894,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/windmill-runtime-nativets/src/windmill-client.js#L9858-L9894","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Verify the exact resource path exists in the Windmill UI (Resources page) in the workspace your token targets","Pass undefinedIfEmpty=true if a missing resource should yield undefined instead of throwing","Check WM_WORKSPACE / token workspace matches where the resource lives","Create the resource or fix the path prefix (u/<user>/..., f/...)","Grant the caller's group/token permission to see the resource"],"exampleFix":"// before\nconst r = await getResource('my_resource'); // throws if missing\n// after\nconst r = await getResource('my_resource', undefined, true); // undefinedIfEmpty=true -> returns undefined","handlingStrategy":"fallback","validationCode":"const exists = typeof path === 'string' && path.length > 0;\nif (!exists) throw new Error('resource path required before lookup');","typeGuard":"function hasBody(e) { return e && typeof e.body === 'string' && e.status !== undefined; }","tryCatchPattern":"let resource;\ntry {\n  resource = await getResource(path);\n} catch (e) {\n  if (String(e.message).includes('Resource not found')) resource = undefined;\n  else throw e;\n}","preventionTips":["Always confirm the path in the Windmill Resources page before referencing it","Use the undefinedIfEmpty flag when absence is an expected state","Pin the workspace via WM_WORKSPACE and verify token permissions","Standardize path prefixes (f/, u/<user>/) in a shared constant"],"tags":["windmill","resource","http-404","not-found"],"backgroundTag":"resource-not-found","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"}