Skip to content

Fix SecItemUpdate errSecParam error on Keychain update#138

Merged
altic-dev merged 2 commits intoaltic-dev:mainfrom
veged:fix/keychain-secitemupdate-errSecParam
Feb 4, 2026
Merged

Fix SecItemUpdate errSecParam error on Keychain update#138
altic-dev merged 2 commits intoaltic-dev:mainfrom
veged:fix/keychain-secitemupdate-errSecParam

Conversation

@veged
Copy link
Contributor

@veged veged commented Feb 1, 2026

Summary

  • Add kSecAttrAccessible attribute to SecItemUpdate call to fix errSecParam (-50) error that occurs on some systems when updating existing Keychain items
  • Include OSStatus code in error messages for easier debugging

Problem

When updating provider API keys in Keychain, SecItemUpdate was called with only kSecValueData in the attributes dictionary. On some systems this causes errSecParam (-50) error because the accessibility attribute is missing.

Solution

Pass a properly typed [String: Any] attributes dictionary that includes both kSecValueData and kSecAttrAccessible (consistent with the SecItemAdd path).

Fixes #135

🤖 Generated with Claude Code

veged and others added 2 commits February 1, 2026 19:31
Add kSecAttrAccessible attribute to SecItemUpdate call to fix
errSecParam (-50) error that occurs on some systems when updating
existing Keychain items. Also include OSStatus code in error messages
for easier debugging.

Fixes altic-dev#135

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
kSecAttrAccessible is a protected attribute that cannot be modified
after the Keychain item is created. Attempting to include it in
SecItemUpdate causes errSecParam (-50). Only kSecValueData should
be passed when updating existing items.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@veged
Copy link
Contributor Author

veged commented Feb 1, 2026

now it works — I tested it locally

@altic-dev altic-dev merged commit 501428b into altic-dev:main Feb 4, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[🐞 BUG] Custom AI provider settings are regularly lost

2 participants