Skip to content

bug: credentials endpoint crashes (500) when OPEN_NOTEBOOK_ENCRYPTION_KEY is wrong instead of handling gracefully #740

Description

@lfnovo

Problem

When OPEN_NOTEBOOK_ENCRYPTION_KEY doesn't match the key used to encrypt saved credentials, the GET /api/credentials endpoint returns a 500 Internal Server Error, making the entire credentials page inaccessible.

This happens even though get_by_provider already handles this gracefully (it logs a warning and skips the invalid credential). The list_credentials endpoint doesn't have the same resilience.

Current behavior

ERROR | api.routers.credentials:list_credentials:113 - Error listing credentials: 
Decryption failed: data appears to be encrypted but key is incorrect.
GET /api/credentials HTTP/1.1" 500 Internal Server Error

The user can't see, manage, or delete their credentials through the UI. The only recovery path is going directly to SurrealDB.

Expected behavior

  • list_credentials should skip credentials that fail to decrypt (same behavior as get_by_provider), returning the ones that work and optionally flagging the broken ones
  • Ideally, show a warning in the UI for credentials that couldn't be decrypted, with a clear action to delete them

Why this matters

This is the most common symptom when a user misconfigures OPEN_NOTEBOOK_ENCRYPTION_KEY (e.g. leaves the placeholder value, or changes it after credentials were saved). The 500 error makes recovery confusing — users think their data is lost, when it's just inaccessible.

Related

Surfaced in #720.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreadyApproved and ready to be worked on

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions