{"record":{"id":"0bcd63e8873ce640","repo":"windmill-labs/windmill","slug":"variable-at-path-path-already-exists-delete-it-0bcd63","errorCode":null,"errorMessage":"Variable at path ${path} already exists. Delete it or pick another path","messagePattern":"Variable at path (.+?) already exists\\. Delete it or pick another path","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/AppConnectInner.svelte","lineNumber":734,"sourceCode":"\t\t\t\twindow.addEventListener('message', popupListener)\n\t\t\t\twindow.addEventListener('storage', handleStorageEvent)\n\t\t\t\tconsole.log('opening popup', url.toString())\n\t\t\t\twindow.open(url.toString(), '_blank', 'popup=true')\n\t\t\t\tstep += 1\n\t\t\t}\n\t\t} else {\n\t\t\tif (!path) {\n\t\t\t\tif (step == 2) return\n\t\t\t\tthrow Error('Path is not set')\n\t\t\t}\n\t\t\t// Check if variable paths already exist\n\t\t\tif (!manual || linkedSecrets.length <= 1) {\n\t\t\t\tconst exists = await VariableService.existsVariable({\n\t\t\t\t\tworkspace: effectiveWorkspace,\n\t\t\t\t\tpath\n\t\t\t\t})\n\t\t\t\tif (exists) {\n\t\t\t\t\tthrow Error(`Variable at path ${path} already exists. Delete it or pick another path`)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tfor (const secretField of linkedSecrets) {\n\t\t\t\t\tconst varPath = `${path}_${secretField}`\n\t\t\t\t\tconst exists = await VariableService.existsVariable({\n\t\t\t\t\t\tworkspace: effectiveWorkspace,\n\t\t\t\t\t\tpath: varPath\n\t\t\t\t\t})\n\t\t\t\t\tif (exists) {\n\t\t\t\t\t\tthrow Error(\n\t\t\t\t\t\t\t`Variable at path ${varPath} already exists. Delete it or pick another path`\n\t\t\t\t\t\t)\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tlet exists = await ResourceService.existsResource({\n\t\t\t\tworkspace: effectiveWorkspace,\n\t\t\t\tpath","sourceCodeStart":716,"sourceCodeEnd":752,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/AppConnectInner.svelte#L716-L752","documentation":"During the app OAuth connect flow, before creating the credential variable the frontend calls `VariableService.existsVariable` for the chosen path. If a variable already exists there, it throws \"Variable at path <path> already exists. Delete it or pick another path\". Windmill variable paths are unique per workspace, so a collision blocks writing new OAuth credentials.","triggerScenarios":"Calling `next()` (from connectOauth/selectFromOthers/open/processPopupData/next) with `manual == true` having a single linkedSecret (or `linkedSecrets.length <= 1`), where `VariableService.existsVariable({workspace, path})` returns true.","commonSituations":"Re-running the connect wizard for an app whose credentials variable was created in a previous attempt; two apps configured with the same path; a stale variable left behind after a deleted resource.","solutions":["Pick a different, unique path in the connect dialog (e.g. suffix it with the app or environment name).","Delete the existing variable at that path (Variables page in the workspace) if it is stale, then retry.","If the existing variable holds the credentials you want, skip re-creation and link the resource to the existing variable instead.","Check the workspace in `effectiveWorkspace` — the collision may exist in the wrong workspace context."],"exampleFix":"// before: path collides with an existing variable\npath = 'hubspot_credentials';\nawait next();\n\n// after: ensure a unique path up front\npath = 'hubspot_credentials';\nif (await VariableService.existsVariable({ workspace, path })) {\n  path = 'hubspot_credentials_v2';\n}\nawait next();","handlingStrategy":"validation","validationCode":"// before starting the connect flow\nif (await VariableService.existsVariable({ workspace, path })) {\n  // pick another path or plan to reuse/delete the existing variable\n  path = `${path}_${Date.now()}`;\n}","typeGuard":null,"tryCatchPattern":"try {\n  await next();\n} catch (e) {\n  if (e instanceof Error && /already exists/.test(e.message)) {\n    const p = e.message.match(/path (\\S+) already/)?.[1];\n    // offer rename or delete UI for the conflicting variable\n  } else throw e;\n}","preventionTips":["Pre-check VariableService.existsVariable before advancing the wizard.","Use workspace-unique naming conventions (prefix paths with the app/environment).","Clean up credential variables when deleting the associated resource.","Confirm you are in the intended workspace — collisions are per-workspace."],"tags":["windmill","svelte","frontend","oauth","variable","duplicate-path"],"backgroundTag":"variable-path-already-exists","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"}