App crash - problem in saving the pass to keychain

I've implemented a MacOS app that among other things, uses keychain to save the user's password.

For most of the time it works great, but every now and then, when I try to save the password - it crashes the app.

The error I'm getting is:

errSecNotAvailable (OSStatus -25291)

I see that the description for this error is "No trust results are available."

I can't repreduce it, but it's happened to some of my users.

The code I'm using for the keychain part is taken from Apple's SimpleTunnel sample


What does this error means? How can I fix it ?



This is partial stack trace:

Exception Type:  SIGILL
Exception Codes: ILL_NOOP at 0x0
Crashed Thread:  0

Application Specific Information:
Selector name found in current argument registers: release

Thread 0 Crashed:
0   MyApp                           0x000000010105fda1 0x101020000 + 261537
1   MyApp                          0x0000000101060130 0x101020000 + 262448
2   MyApp                          0x000000010107019f 0x101020000 + 328095
3   MyApp                          0x000000010106f972 0x101020000 + 326002
4   libsystem_trace.dylib                0x00007fffe11d93a7 _os_activity_initiate_impl + 53
5   AppKit                               0x00007fffc9a96721 -[NSApplication(NSResponder) sendAction:to:from:] + 456
6   AppKit                               0x00007fffc957acc4 -[NSControl sendAction:to:] + 86
7   AppKit                               0x00007fffc957abec __26-[NSCell _sendActionFrom:]_block_invoke + 136
8   libsystem_trace.dylib                0x00007fffe11d93a7 _os_activity_initiate_impl + 53
9   AppKit                               0x00007fffc957ab44 -[NSCell _sendActionFrom:] + 128
10  AppKit                               0x00007fffc95bd539 -[NSButtonCell _sendActionFrom:] + 98
11  libsystem_trace.dylib                0x00007fffe11d93a7 _os_activity_initiate_impl + 53
12  AppKit                               0x00007fffc9579426 -[NSCell trackMouse:inRect:ofView:untilMouseUp:] + 2481
13  AppKit                               0x00007fffc95bd272 -[NSButtonCell trackMouse:inRect:ofView:untilMouseUp:] + 798
14  AppKit                               0x00007fffc9577ddb -[NSControl mouseDown:] + 832
15  AppKit                               0x00007fffc9c1224f -[NSWindow(NSEventRouting) _handleMouseDownEvent:isDelayedEvent:] + 6341
16  AppKit                               0x00007fffc9c0ea6c -[NSWindow(NSEventRouting) _reallySendEvent:isDelayedEvent:] + 1942
17  AppKit                               0x00007fffc9c0df0a -[NSWindow(NSEventRouting) sendEvent:] + 541
18  AppKit                               0x00007fffc9a92681 -[NSApplication(NSEvent) sendEvent:] + 1145
19  AppKit                               0x00007fffc930d427 -[NSApplication run] + 1002
20  AppKit                               0x00007fffc92d7e0e NSApplicationMain + 1237
21  MyApp                          0x0000000101022219 0x101020000 + 8729
22  libdyld.dylib                        0x00007fffe0fa7235 start + 1

I see that the description for this error is "No trust results are available."

Ah, um, no it’s not. From

<Security/SecBase.h>
:
errSecNotAvailable = -25291, /* No keychain is available. You may need to restart your computer. */

which doesn’t bode well. As I mentioned on the other thread you found, this is unlikely to be related to how you’re using the keychain.

The next time you reproduce the problem you should take a sysdiagnose of your Mac (per the instructions on our Bug Reporting > Profiles and Logs page) and file a bug. Once you’ve done that post the bug number here.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"
Bumping this old thread.
Not this issue happened to one of my users. Failed saving to keychain with error: -25291.
I just asked them to restart their Mac, I'll report back with the results.
But if it will reproduce, can I ask them to run sysdiagnose on their Mac, or is it just for developers? What else can I do? They already sent me their Console logs.
App crash - problem in saving the pass to keychain
 
 
Q