{"record":{"id":"d5004a904c926890","repo":"windmill-labs/windmill","slug":"user-email-not-found","errorCode":null,"errorMessage":"User ${email} not found","messagePattern":"User (.+?) not found","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"cli/src/commands/sync/sync.ts","lineNumber":6436,"sourceCode":"                    } else {\n                      throw e;\n                    }\n                  }\n                  deletedVarsResPaths.push(variablePath);\n                  break;\n                }\n                case \"user\": {\n                  const users = await wmill.listUsers({\n                    workspace: workspaceId,\n                  });\n\n                  const email = removeSuffix(\n                    removePathPrefix(change.path, \"users\"),\n                    \".user.json\",\n                  );\n                  const user = users.find((u) => u.email === email);\n                  if (!user) {\n                    throw new Error(`User ${email} not found`);\n                  }\n                  await wmill.deleteUser({\n                    workspace: workspaceId,\n                    username: user.username,\n                  });\n                  break;\n                }\n                case \"group\":\n                  await wmill.deleteGroup({\n                    workspace: workspaceId,\n                    name: removeSuffix(\n                      removePathPrefix(change.path, \"groups\"),\n                      \".group.json\",\n                    ),\n                  });\n                  break;\n                case \"workspace_dependencies\":\n                  const relativePath = removePathPrefix(","sourceCodeStart":6418,"sourceCodeEnd":6454,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/sync/sync.ts#L6418-L6454","documentation":"`wmill sync delete` maps a users/<email>.user.json file back to a remote user. It first fetches the user list from the remote workspace and looks up the user by email; if none matches, it throws this error rather than calling deleteUser with a fabricated username. The remote username is required for the delete API.","triggerScenarios":"Running a sync delete where the local file users/foo@bar.com.user.json exists but the remote workspace has no user with email foo@bar.com — e.g. the user was already deleted remotely, renamed, or the CLI is pointed at the wrong workspace.","commonSituations":"Pointing at a different workspace than the one the sync folder was pulled from; user deleted by an admin out-of-band; email casing mismatch after a remote rename.","solutions":["Verify you are on the intended workspace (`wmill switch` / --workspace flag)","Confirm the user still exists in the workspace settings; if already deleted, remove the stale local file and re-sync","Re-run `wmill sync pull` to refresh users from the remote","Check email spelling/case matches the remote user exactly"],"exampleFix":"// before: stale local file drives delete\nusers/left@company.com.user.json  (user already removed remotely)\n// after: prune stale state then delete\nwmill sync pull && rm users/left@company.com.user.json && wmill sync delete","handlingStrategy":"validation","validationCode":"const remote = await wmill.listUsers({ workspace: workspaceId });\nconst exists = remote.some(u => u.email === \"foo@bar.com\");\nif (!exists) throw new Error(\"skip delete: user absent remotely\");","typeGuard":null,"tryCatchPattern":"try {\n  await wmill.sync.delete(opts);\n} catch (e) {\n  if (/^User .* not found$/.test(String(e.message))) {\n    // stale local file — prune and continue\n    fs.rmSync(localUserFile);\n  }\n}","preventionTips":["Re-pull user state before delete runs","Confirm workspace with `wmill workspace current`","Treat local user files as cache, not source of truth"],"tags":["cli","sync","users","workspace-state"],"backgroundTag":"remote-entity-not-found","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}