{"record":{"id":"681b9cee84d5d927","repo":"windmill-labs/windmill","slug":"could-not-find-username-for-email-email-in-wo","errorCode":null,"errorMessage":"Could not find username for email '${email}' in workspace. Make sure the user exists in the workspace.","messagePattern":"Could not find username for email '(.+?)' in workspace\\. Make sure the user exists in the workspace\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/core/permissioned_as.ts","lineNumber":33,"sourceCode":"  cache: Map<string, { username: string; email: string }>\n): Promise<void> {\n  if (cache.size > 0) return;\n  const users = await wmill.listUsers({ workspace });\n  for (const user of users) {\n    cache.set(user.username, { username: user.username, email: user.email });\n    cache.set(user.email, { username: user.username, email: user.email });\n  }\n}\n\nexport async function lookupUsernameByEmail(\n  workspace: string,\n  email: string,\n  cache: Map<string, { username: string; email: string }>\n): Promise<string> {\n  await ensureUserCache(workspace, cache);\n  const entry = cache.get(email);\n  if (!entry) {\n    throw new Error(\n      `Could not find username for email '${email}' in workspace. ` +\n        `Make sure the user exists in the workspace.`\n    );\n  }\n  return entry.username;\n}\n\nexport interface Change {\n  name: \"edited\" | \"added\" | \"deleted\";\n  path: string;\n  before?: string;\n  after?: string;\n  content?: string;\n}\n\nfunction contentHasOnBehalfOf(content: string, typeStr: string): boolean {\n  if (typeStr === \"script\") {\n    return (","sourceCodeStart":15,"sourceCodeEnd":51,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/core/permissioned_as.ts#L15-L51","documentation":"lookupUsernameByEmail built the workspace user cache via listUsers and found no user whose username or email matches the given email, so run-as identity resolution fails for settings like schedules/triggers that reference users by email.","triggerScenarios":"Thrown at cli/src/core/permissioned_as.ts:33 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Confirm the user exists in that workspace (Users page or `wmill user list`).","Check the email spelling and casing.","Invite the user to the workspace first, then retry."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}