{"record":{"id":"6d806f24fe1ed451","repo":"windmill-labs/windmill","slug":"resource-at-path-path-is-occupanttype-a","errorCode":null,"errorMessage":"Resource at path ${path} is ${occupantType ? `a ${occupantType} resource` : 'of an unknown type'}, not ${resourceType}. Move or rename it, then import again.","messagePattern":"Resource at path (.+?) is (.+?) resource` : 'of an unknown type'\\}, not (.+?)\\. Move or rename it, then import again\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/AppConnectInner.svelte","lineNumber":782,"sourceCode":"\t\t\tif (filling) {\n\t\t\t\t// Fails closed. Only a read that succeeds and answers with exactly this type\n\t\t\t\t// permits the write — a failed read, a missing type, or any other type all\n\t\t\t\t// refuse. Letting \"could not tell\" through is how the overwrite this guard\n\t\t\t\t// exists to stop would happen anyway, on the one occasion the check was needed\n\t\t\t\t// and could not run.\n\t\t\t\tlet occupantType: string | undefined\n\t\t\t\ttry {\n\t\t\t\t\toccupantType = (\n\t\t\t\t\t\tawait ResourceService.getResource({ workspace: effectiveWorkspace, path })\n\t\t\t\t\t)?.resource_type\n\t\t\t\t} catch (e: any) {\n\t\t\t\t\tthrow Error(\n\t\t\t\t\t\t`Could not read what is already at ${path} (${e?.body ?? e?.message ?? e}), ` +\n\t\t\t\t\t\t\t`so it will not be written over. Try again.`\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t\tif (occupantType !== resourceType) {\n\t\t\t\t\tthrow Error(\n\t\t\t\t\t\t`Resource at path ${path} is ${\n\t\t\t\t\t\t\toccupantType ? `a ${occupantType} resource` : 'of an unknown type'\n\t\t\t\t\t\t}, not ${resourceType}. Move or rename it, then import again.`\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (exists && !filling) {\n\t\t\t\tthrow Error(`Resource at path ${path} already exists. Delete it or pick another path`)\n\t\t\t}\n\n\t\t\t// Per-instance OAuth providers (Snowflake, ServiceNow, …): fill the\n\t\t\t// resource args from the connection's instance, per the registry\n\t\t\t// template's resource_mapping (e.g. ServiceNow -> instance_url:\n\t\t\t// https://{instance}.service-now.com). Bring-your-own carries the instance\n\t\t\t// the user entered in `ccInstance` (raw, possibly a full host); the shared\n\t\t\t// path carries it (already normalized) in the connect entry's extra_params.\n\t\t\t// Prefer the user-entered one so the saved resource matches the exchange.\n\t\t\tconst connectTemplate = registryEntryFor(resourceType)?.connect_config_template","sourceCodeStart":764,"sourceCodeEnd":800,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/AppConnectInner.svelte#L764-L800","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Move or rename the existing resource at that path (as the message instructs) and retry the import","Delete the old resource if it is no longer needed","Pick a different path in the connect dialog","Verify the provider template in the registry is the one you intend, in case resourceType is not what you expected"],"exampleFix":"// before: reusing occupied path\nconst path = 'u/servicenow/creds';\n// after: clear or rename the occupant first\nawait ResourceService.deleteResource({ workspace, path: 'u/servicenow/creds' });\nawait connectNext();","handlingStrategy":"validation","validationCode":"const existing = await ResourceService.getResource({ workspace, path });\nif (existing && existing.resource_type !== expectedResourceType) {\n  throw new Error(`Path ${path} holds a ${existing.resource_type}; move it before importing`);\n}","typeGuard":"function isCorrectType(r: { resource_type?: string } | null | undefined, expected: string): boolean {\n  return r?.resource_type === expected;\n}","tryCatchPattern":"try { await connectNext(); } catch (e) {\n  if (/not .*\\. Move or rename it/.test(String(e))) await handleTypeConflict(path);\n  else throw e;\n}","preventionTips":["Use unique, provider-specific paths (e.g. u/<provider>/creds)","Clean up resources from previous connect attempts","Do not reuse the same path across different OAuth providers"],"tags":["oauth","resource","conflict","frontend"],"backgroundTag":"resource-type-conflict","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}