beekeeper-studio/beekeeper-studio · error
No pin found.
Error message
No pin found.
What it means
UserPin.verifyPin compares a candidate pin against the stored bcrypt hash. If no UserPin row exists at all (count === 0) it throws "No pin found." instead of returning false, because there is nothing to compare against — verification requires a pin to have been set.
Source
Thrown at apps/studio/src/common/appdb/models/UserPin.ts:55
}
const isOldPinCorrect = await UserPin.verifyPin(oldPin, userPin);
if (!isOldPinCorrect) {
throw new Error("Old pin is incorrect");
}
if (newPin.length < bksConfig.security.minPinLength) {
throw new Error(`Pin must be at least ${bksConfig.security.minPinLength} characters long`);
}
userPin.hash = await bcrypt.hash(newPin, saltRounds);
return await userPin.save();
}
static async verifyPin(pin: string, userPin?: UserPin): Promise<boolean> {
if ((await UserPin.count()) === 0) {
throw new Error("No pin found.");
}
if (!userPin) {
userPin = (await UserPin.find())[0];
}
return await bcrypt.compare(pin, userPin.hash);
}
}
View on GitHub (pinned to 4e3e03e322)
Solutions
- Check UserPin.count() > 0 before calling verifyPin; skip pin verification entirely when none is set.
- Create a pin first (UserPin.createPin) if the feature requires one.
- Catch the error and treat it as 'pin not configured' to route the user to setup instead of unlock.
Example fix
// before
const ok = await UserPin.verifyPin(input);
// after
if ((await UserPin.count()) === 0) {
return; // no pin configured, nothing to verify
}
const ok = await UserPin.verifyPin(input); Defensive patterns
Strategy: validation
Validate before calling
const pinConfigured = (await UserPin.count()) > 0;
if (!pinConfigured) {
return; // nothing to verify; skip unlock or route to setup
} Try / catch
try {
const ok = await UserPin.verifyPin(input);
} catch (e) {
if (e.message === 'No pin found.') {
// treat as 'pin not configured' — route to setup flow
}
} Prevention
- Check UserPin.count() before showing unlock/verification prompts.
- Never call verifyPin on profiles where setup has not run.
- Seed a pin in tests before any verification assertions.
When it happens
Trigger: Calling UserPin.verifyPin(pin) (with or without an explicit userPin argument) when UserPin.count() === 0 — e.g. unlock or auth checks running before any pin was created.
Common situations: Unlock prompt shown on a fresh install with no pin configured; app databases wiped or migrated without the pin table populated; tests calling verifyPin before seeding a pin.
Related errors
- No pin found
- Authentication is required.
- Invalid authentication mode: ${auth.mode}
- Incorrect pin. Please try again.
- Cannot create a new pin. A pin already exists. You can only
AI-assisted analysis of beekeeper-studio/beekeeper-studio@4e3e03e322 (2026-08-31).
Data as JSON: /api/errors/01ec426012c0b073.
Report an issue: GitHub.