windmill-labs/windmill · error · Error

Resource not found at

Error message

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

What it means

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.

Solutions

  1. Verify the resource path is correct and the resource exists in the target workspace (Resources page).
  2. Confirm the job/script runs in the same workspace as the resource, or prefix with the right workspace path.
  3. Check token/worker permissions — 403 means the caller cannot see the resource.
  4. If the resource may legitimately be absent, call getResource(path, undefinedIfEmpty=true) and handle undefined.
  5. Inspect e.body in the error message for the server's actual reason.

Example fix

// before
const db = await getResource('u/alice/postgres') // throws when missing
// after
const db = await getResource('u/alice/postgres', true)
if (!db) throw new Error('postgres resource not configured')
await useDb(db)
Defensive patterns

Strategy: try-catch

Type guard

function isNotFound(e: unknown): e is { status: number; body: string } {
  return typeof e === 'object' && e !== null && (e as any).status === 404
}

Try / catch

try {
  const res = await getResource(path, true)
} catch (e) {
  if (e?.status === 404) {
    console.warn(`Resource ${path} not found`) // only non-404 failures reach here when undefinedIfEmpty=true
  } else if (e?.status === 403) {
    throw new Error(`No permission to read resource ${path}`)
  } else throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

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/075f5924e2b1ad78. Report an issue: GitHub.

Appendix: source

Thrown at typescript-client/client.ts:138

    } else {
      console.log(
        `MockedAPI present, but resource not found at ${path}, falling back to real API`
      );
    }
  }

  const workspace = getWorkspace();

  try {
    return await ResourceService.getResourceValueInterpolated({
      workspace,
      path,
    });
  } catch (e: any) {
    if (undefinedIfEmpty && e.status === 404) {
      return undefined;
    } else {
      throw Error(
        `Resource not found at ${path} or not visible to you: ${e.body}`
      );
    }
  }
}

/**
 * Get the true root job id
 * @param jobId job id to get the root job id from (default to current job)
 * @returns root job id
 */
export async function getRootJobId(jobId?: string): Promise<string> {
  const workspace = getWorkspace();
  jobId = jobId ?? getEnv("WM_JOB_ID");
  if (jobId === undefined) {
    throw Error("Job ID not set");
  }
  return await JobService.getRootJobId({ workspace, id: jobId });

View on GitHub (pinned to e474e8803c)