apache/answer · error

user not found: %s

Error message

user not found: %s

What it means

Fires in ResetPassword when userRepo.GetByEmail returns exist=false for the given email, meaning no user account matches the email typed at the prompt or passed via --email. It is a plain fmt.Errorf sentinel raised on a validation-style guard against a wrong/typo'd email address.

Source

Thrown at internal/cli/reset_password.go:118

	authSvc := authService.NewAuthService(authRepo, apiKeyRepo)

	email := strings.TrimSpace(opts.Email)
	if email == "" {
		reader := bufio.NewReader(os.Stdin)
		fmt.Print("Please input user email: ")
		emailInput, err := reader.ReadString('\n')
		if err != nil {
			return fmt.Errorf("read email input failed: %w", err)
		}
		email = strings.TrimSpace(emailInput)
	}

	userInfo, exist, err := userRepo.GetByEmail(ctx, email)
	if err != nil {
		return fmt.Errorf("query user failed: %w", err)
	}
	if !exist {
		return fmt.Errorf("user not found: %s", email)
	}

	fmt.Printf("You are going to reset password for user: %s\n", email)

	password := strings.TrimSpace(opts.Password)

	if password != "" {
		printWarning("Passing password via command line may be recorded in shell history")
		if err := checker.CheckPassword(password); err != nil {
			return fmt.Errorf("password validation failed: %w", err)
		}
	} else {
		password, err = promptForPassword()
		if err != nil {
			return fmt.Errorf("password input failed: %w", err)
		}
	}

View on GitHub (pinned to 3b9f137061)

Solutions

  1. Verify the email address was typed correctly and matches an existing account
  2. Check the database for the user with a direct query (SELECT from users WHERE email = ...) to confirm the record exists
  3. If the user truly does not exist, create the account first or use the admin user-creation flow instead of resetting a password
  4. Confirm the CLI is pointed at the correct database/environment connection string
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at internal/cli/reset_password.go:118 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/answer@3b9f137061 (2026-09-05). Data as JSON: /api/errors/76a04919838ccb6a. Report an issue: GitHub.