windmill-labs/windmill · error

Resource at path ${path} is ${occupantType ? `a ${occupantTy

Error message

Resource at path ${path} is ${occupantType ? `a ${occupantType} resource` : 'of an unknown type'}, not ${resourceType}. Move or rename it, then import again.

What it means

During the app OAuth connect flow, `next` reads the resource type of whatever already exists at the chosen path. If the occupant's resource type differs from the resource type the OAuth template requires, Windmill blocks the write because overwriting would replace a differently-typed resource.

Source

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

			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
			// template's resource_mapping (e.g. ServiceNow -> instance_url:
			// https://{instance}.service-now.com). Bring-your-own carries the instance
			// the user entered in `ccInstance` (raw, possibly a full host); the shared
			// path carries it (already normalized) in the connect entry's extra_params.
			// Prefer the user-entered one so the saved resource matches the exchange.
			const connectTemplate = registryEntryFor(resourceType)?.connect_config_template

View on GitHub (pinned to e474e8803c)

Solutions

  1. Move or rename the existing resource at that path (as the message instructs) and retry the import
  2. Delete the old resource if it is no longer needed
  3. Pick a different path in the connect dialog
  4. Verify the provider template in the registry is the one you intend, in case resourceType is not what you expected

Example fix

// before: reusing occupied path
const path = 'u/servicenow/creds';
// after: clear or rename the occupant first
await ResourceService.deleteResource({ workspace, path: 'u/servicenow/creds' });
await connectNext();
Defensive patterns

Strategy: validation

Validate before calling

const existing = await ResourceService.getResource({ workspace, path });
if (existing && existing.resource_type !== expectedResourceType) {
  throw new Error(`Path ${path} holds a ${existing.resource_type}; move it before importing`);
}

Type guard

function isCorrectType(r: { resource_type?: string } | null | undefined, expected: string): boolean {
  return r?.resource_type === expected;
}

Try / catch

try { await connectNext(); } catch (e) {
  if (/not .*\. Move or rename it/.test(String(e))) await handleTypeConflict(path);
  else throw e;
}

Prevention

When it happens

Trigger: User types a path in the connect dialog that already holds a resource whose resource_type differs from `resourceType` derived from the OAuth registry template (e.g. a script-shaped or wrongly-typed resource at that path), or the existing resource has no readable type.

Common situations: Reusing a path from a previous connect attempt for a different OAuth provider, copying paths across provider configs, or a leftover resource created manually with a mismatched type.

Related errors


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