plandex-ai/plandex · error

not found

Error message

not found

What it means

ValidateAndSignIn, email branch: db.GetUserByEmail returned nil for the submitted (lowercased) email. Deliberately vague 'not found' message to avoid leaking which emails are registered; credential checks never proceed.

Source

Thrown at app/server/handlers/auth_helpers.go:335

		if user == nil {
			log.Printf("User not found for id: %v\n", res.UserId)
			return nil, fmt.Errorf("user not found")
		}

		signInCodeId = res.Id
		signInCodeOrgId = res.OrgId
	} else {
		req.Email = strings.ToLower(req.Email)
		user, err = db.GetUserByEmail(req.Email)

		if err != nil {
			log.Printf("Error getting user: %v\n", err)
			return nil, fmt.Errorf("error getting user: %v", err)
		}

		if user == nil {
			log.Printf("User not found for email: %v\n", req.Email)
			return nil, fmt.Errorf("not found")
		}

		// only validate email in non-local mode
		if !isLocalMode {
			emailVerificationId, err = db.ValidateEmailVerification(req.Email, req.Pin)

			if err != nil {
				log.Printf("Error validating email verification: %v\n", err)
				return nil, fmt.Errorf("error validating email verification: %v", err)
			}

			log.Println("Email verification successful")
		}
	}

	var token string
	var authTokenId string

View on GitHub (pinned to e2d772072e)

Solutions

  1. Confirm the email is registered (check users table or have user re-register)
  2. Ensure client points at the correct environment/database
  3. Trim/normalize the email client-side before submitting
  4. If the account should exist, investigate deletion jobs or signup failures

Example fix

// before
return nil, fmt.Errorf("not found")
// after
log.Printf("no user for email=%s", req.Email)
return nil, fmt.Errorf("not found") // keep generic to avoid enumeration
Defensive patterns

Strategy: validation

Validate before calling

// client-side check before calling sign-in
if !strings.Contains(strings.TrimSpace(email), "@") {
	return errors.New("please enter a valid email")
}

Try / catch

user, err := ValidateAndSignIn(w, r, req)
if err != nil {
	if err.Error() == "not found" {
		// generic on purpose — do not confirm/deny email existence to callers
		http.Error(w, "invalid email or pin", http.StatusUnauthorized)
		return
	}
	http.Error(w, err.Error(), http.StatusUnauthorized)
}

Prevention

When it happens

Trigger: Client submits email+pin sign-in with an email that has no matching user row; the local-mode bypass is not active.

Common situations: Typo in email; user signed up with a different address; user account deleted; client hitting the wrong environment's database; case/format differences resolved by ToLower but still no match.

Understand the failure class

Background: "User not found", "Invalid user", and "does not exist": what missing-user lookup errors mean across Rocket.Chat, LiteLLM, Phabricator, rustfs, and pnpm — this error's family across 10 libraries.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/826cfabdbd9d00c7. Report an issue: GitHub.