zed-industries / zed

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
https://zed.dev
Other
46.84k stars 2.68k forks source link

Assistant OpenAI Key: [ERROR] delete password failed: -25300 #16282

Open Thomascountz opened 4 weeks ago

Thomascountz commented 4 weeks ago

Check for existing issues

Describe the bug / provide steps to reproduce it

I have previously configured my OpenAI key using a previous version of Zed before #15490, but that key has since expired. I also have a OPENAI_API_KEY envvar set with a valid key, though Zed is using the originally configured (now expired) key.

  1. Open Assistant panel
  2. Click 3-horizontal-lines button to open the menu
  3. Click "Configure"
  4. Under "OpenAI" I see "✔︎ API key configured." and a "🗑️ Reset key" button
  5. When I click the "Reset key" button, nothing happens a. I expect the option to enter a new key or a message indicating the key was deleted
  6. When I open the Zed logs, I see this error: [ERROR] delete password failed: -25300

Environment

Zed: v0.149.0 (Zed Preview) AND Zed: v0.148.0 (Zed) OS: macOS 14.5.0 Memory: 32 GiB Architecture: x86_64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log

2024-08-15T11:20:28.869828Z [ERROR] delete password failed: -25300
Moshyfawn commented 4 weeks ago

Reminiscent of:

notpeter commented 4 weeks ago

~I was not able to reproduce. When I clicked Reset Key the key was correctly removed from Keychain Access.~

Update: I was able to partially reproduce. In the past I clicked "Always Allow" to the prompt from each of the Zed channels (Stable, Preview, Nightly) and pressing "Reset Key" would remove the keychain entry as expected. Using Always and toggling between Zed channels will trigger the behavior.

Steps to reproduce:

  1. Remove any existing OpenAPI keys from Keychain Access
  2. Open / Reload Zed Stable
  3. Enter an OpenAPI key into Zed and press enter.
  4. Quit Zed Stable
  5. Open Zed Preview and open the Assistant Configuration Panel
  6. Enter your keychain password when prompted and press press "Allow" (not "Always Allow").
  7. Click "Reset Key"

You will see the Keychain item is still present and the [ERROR] delete password failed: -25300 in your logs.

Workaround: You should be able to open Keychain Access and manually delete it.

image
Thomascountz commented 3 weeks ago

Thank you @notpeter! The workaround works; Zed is now using my environment variable.