{"record":{"id":"075f5924e2b1ad78","repo":"windmill-labs/windmill","slug":"resource-not-found-at-path-or-not-visible-to-yo-075f59","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":"typescript-client/client.ts","lineNumber":138,"sourceCode":"    } else {\n      console.log(\n        `MockedAPI present, but resource not found at ${path}, falling back to real API`\n      );\n    }\n  }\n\n  const workspace = getWorkspace();\n\n  try {\n    return await ResourceService.getResourceValueInterpolated({\n      workspace,\n      path,\n    });\n  } catch (e: any) {\n    if (undefinedIfEmpty && e.status === 404) {\n      return undefined;\n    } else {\n      throw Error(\n        `Resource not found at ${path} or not visible to you: ${e.body}`\n      );\n    }\n  }\n}\n\n/**\n * Get the true root job id\n * @param jobId job id to get the root job id from (default to current job)\n * @returns root job id\n */\nexport async function getRootJobId(jobId?: string): Promise<string> {\n  const workspace = getWorkspace();\n  jobId = jobId ?? getEnv(\"WM_JOB_ID\");\n  if (jobId === undefined) {\n    throw Error(\"Job ID not set\");\n  }\n  return await JobService.getRootJobId({ workspace, id: jobId });","sourceCodeStart":120,"sourceCodeEnd":156,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/typescript-client/client.ts#L120-L156","documentation":"In the Windmill TypeScript client (typescript-client/client.ts), getResource(path) fetches a Windmill resource by path and throws this Error when the request fails outside the tolerated case. undefinedIfEmpty lets callers treat 404 as 'no resource'; any other failure status (401/403/500) — or a 404 when undefinedIfEmpty is false — produces this error, with the response body appended to aid diagnosis.","triggerScenarios":"getResource('u/user/foo') where the resource path doesn't exist (404 with undefinedIfEmpty falsy); the workspace's token lacks read permission on the resource (403); the worker/job runs in a different workspace than the resource; the HTTP call otherwise fails with a non-404 status.","commonSituations":"Typo'd or renamed resource path in a script; resource moved between folders/users so the relative path no longer resolves; running a job under a different workspace than where the resource lives; expired/insufficient token returning 403; passing undefinedIfEmpty=false to a lookup that legitimately may not exist.","solutions":["Verify the resource path is correct and the resource exists in the target workspace (Resources page).","Confirm the job/script runs in the same workspace as the resource, or prefix with the right workspace path.","Check token/worker permissions — 403 means the caller cannot see the resource.","If the resource may legitimately be absent, call getResource(path, undefinedIfEmpty=true) and handle undefined.","Inspect e.body in the error message for the server's actual reason."],"exampleFix":"// before\nconst db = await getResource('u/alice/postgres') // throws when missing\n// after\nconst db = await getResource('u/alice/postgres', true)\nif (!db) throw new Error('postgres resource not configured')\nawait useDb(db)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":"function isNotFound(e: unknown): e is { status: number; body: string } {\n  return typeof e === 'object' && e !== null && (e as any).status === 404\n}","tryCatchPattern":"try {\n  const res = await getResource(path, true)\n} catch (e) {\n  if (e?.status === 404) {\n    console.warn(`Resource ${path} not found`) // only non-404 failures reach here when undefinedIfEmpty=true\n  } else if (e?.status === 403) {\n    throw new Error(`No permission to read resource ${path}`)\n  } else throw e\n}","preventionTips":["Pass undefinedIfEmpty=true for resources that may legitimately be missing.","Copy resource paths from the Resources page instead of typing them.","Verify the job's workspace matches the resource's workspace.","Check token/worker permissions for 403 failures."],"tags":["windmill-client","resources","http-404","typescript"],"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"}