windmill-labs/windmill · error

Could not read what is already at ${path} (${e?.body ?? e?.m

Error message

Could not read what is already at ${path} (${e?.body ?? e?.message ?? e}), so it will not be written over. Try again.

What it means

In the app OAuth connect flow (AppConnectInner.svelte `next`), before writing a resource at the user-chosen path, Windmill reads the existing resource to check whether the path is already occupied. If `ResourceService.getResource` throws (network error, 404-with-error, permission denial, malformed body), the code cannot verify what is there and refuses to overwrite, throwing this error with the underlying message embedded.

Source

Thrown at frontend/src/lib/components/AppConnectInner.svelte:776

			// The type is checked here and not only by the caller: `fillPath` says "write into
			// this path", and a path says nothing about what lives at it. A workspace resource
			// of another type sitting where the project wanted one of ours would otherwise have
			// its value replaced with credentials for a different provider, while keeping its
			// own type — destroying a working resource that has nothing to do with the import.
			const filling = exists && !!fillPath && path === fillPath
			if (filling) {
				// Fails closed. Only a read that succeeds and answers with exactly this type
				// permits the write — a failed read, a missing type, or any other type all
				// refuse. Letting "could not tell" through is how the overwrite this guard
				// exists to stop would happen anyway, on the one occasion the check was needed
				// and could not run.
				let occupantType: string | undefined
				try {
					occupantType = (
						await ResourceService.getResource({ workspace: effectiveWorkspace, path })
					)?.resource_type
				} catch (e: any) {
					throw Error(
						`Could not read what is already at ${path} (${e?.body ?? e?.message ?? e}), ` +
							`so it will not be written over. Try again.`
					)
				}
				if (occupantType !== resourceType) {
					throw Error(
						`Resource at path ${path} is ${
							occupantType ? `a ${occupantType} resource` : 'of an unknown type'
						}, not ${resourceType}. Move or rename it, then import again.`
					)
				}
			}
			if (exists && !filling) {
				throw Error(`Resource at path ${path} already exists. Delete it or pick another path`)
			}

			// Per-instance OAuth providers (Snowflake, ServiceNow, …): fill the
			// resource args from the connection's instance, per the registry

View on GitHub (pinned to e474e8803c)

Solutions

  1. Check the embedded inner message: fix the underlying cause (restart backend on the right port, verify REMOTE matches the backend port)
  2. Confirm you are logged into the correct workspace and your token has resource read permission
  3. Retry the flow — the message is explicitly a 'try again' guard against blind overwrite
  4. Manually inspect the path in the resource list and delete it if it exists before retrying

Example fix

// before: error swallowed by throw, retry loop absent
try { await connectNext() } catch (e) { console.error(e) }
// after: surface and retry once after connectivity check
try {
  await assertBackendReachable();
  await connectNext();
} catch (e) {
  if (/Could not read what is already at/.test(String(e))) await retryConnectNext();
  else console.error(e);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// before connecting
const res = await fetch(`${backendUrl}/api/w/${workspace}/resources/get/${encodeURIComponent(path)}`);
if (!res.ok) throw new Error(`Cannot verify path ${path}: ${res.status}; refusing to proceed`);

Type guard

function isReadableResource(r: unknown): r is { resource_type: string } {
  return !!r && typeof r === 'object' && typeof (r as any).resource_type === 'string';
}

Try / catch

try {
  await connectNext();
} catch (e) {
  if (/Could not read what is already at/.test(String(e))) {
    const cause = String(e).match(/\((.+)\)/)?.[1];
    console.warn('Path verification failed:', cause); // retry or re-auth
  } else throw e;
}

Prevention

When it happens

Trigger: User submits the connect form with a path whose GET /resources lookup fails: backend unreachable, insufficient permissions on the target path, or the resource API returns a non-JSON error body that the client cannot parse.

Common situations: Running the frontend against a stale REMOTE/backend port (proxy 502s), a restricted token that cannot read the workspace resource, or a workspace name typo in effectiveWorkspace so the read 404s with an error body.

Related errors


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