{"record":{"id":"7d775fe5860f9bd1","repo":"semaphoreui/semaphore","slug":"user-with-login-s-not-found","errorCode":null,"errorMessage":"user with login %s not found","messagePattern":"user with login (.+?) not found","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/cmd/user_token.go","lineNumber":54,"sourceCode":"}\n\nvar tokenCmd = &cobra.Command{\n\tUse:   \"token\",\n\tShort: \"Manage user API tokens\",\n\tRun: func(cmd *cobra.Command, args []string) {\n\t\t_ = cmd.Help()\n\t\tos.Exit(0)\n\t},\n}\n\nfunc getTokenUser(store db.Store, login string) (db.User, error) {\n\tif login == \"\" {\n\t\treturn db.User{}, errors.New(\"argument --login required\")\n\t}\n\n\tuser, err := store.GetUserByLoginOrEmail(login, \"\")\n\tif errors.Is(err, db.ErrNotFound) {\n\t\treturn db.User{}, fmt.Errorf(\"user with login %s not found\", login)\n\t}\n\tif err != nil {\n\t\treturn db.User{}, err\n\t}\n\n\treturn user, nil\n}\n\nfunc createUserToken(store db.Store, out io.Writer, args tokenArgs) error {\n\tuser, err := getTokenUser(store, args.login)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tvar expiresAt *time.Time\n\tif args.ttl != \"\" {\n\t\td, err := time.ParseDuration(args.ttl)\n\t\tif err != nil {","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/cli/cmd/user_token.go#L36-L72","documentation":"getTokenUser looks up the user with store.GetUserByLoginOrEmail; when the store returns db.ErrNotFound it is converted into 'user with login %s not found'. This means the --login value matched no user in the database.","triggerScenarios":"Running `semaphore user token create/list --login <name>` where <name> (or email) does not exist in the users table — a typo, a deleted user, or the wrong database/environment.","commonSituations":"Typo in username; running against a different environment's DB than intended; user was removed before token operations; case or exact-match differences in the login name.","solutions":["List existing users (`semaphore user list`) and use an exact login from that output","Create the user first with `semaphore user add` if it genuinely doesn't exist","Confirm the config points at the intended database/environment"],"exampleFix":"// before\nsemaphore user token list --login jonh\n// after\nsemaphore user list            # find correct login\nsemaphore user token list --login john","handlingStrategy":"validation","validationCode":"LOGIN=\"$1\"\nsemaphore user list | grep -Fx \"$LOGIN\" || { echo \"user '$LOGIN' does not exist\"; exit 1; }\nsemaphore user token list --login \"$LOGIN\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Copy logins verbatim from `semaphore user list` instead of typing them","Confirm you're pointed at the right database/environment","Recreate missing users before token operations","Watch for deleted users in scripts that cache login names"],"tags":["cli","user-not-found","user-tokens","database"],"backgroundTag":"user-not-found","analyzedSha":"1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa","analyzedAt":"2026-09-07T11:00:33.293Z","contentChangedAt":"2026-09-07T11:00:33.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}