git-ecosystem/git-credential-manager · error · InteropException
Failed to search for credentials
Error message
Failed to search for credentials
What it means
Enumerate calls secret_service_search_sync (libsecret) to find matching credentials in the GNOME keyring / Secret Service. If the call returns a GError, the error code and message are wrapped in an InteropException with this fixed message and thrown, so the underlying D-Bus/keyring failure is preserved as the inner exception.
Solutions
- Read the inner Exception message (the GError message) for the real cause from the D-Bus daemon
- Ensure a Secret Service provider is running (e.g. start gnome-keyring-daemon or gnome-keyring --components)
- Unlock the keyring/session (e.g. via seahorse or logging into the desktop session)
- Verify you are running in a desktop session with D-Bus session bus available (DBUS_SESSION_BUS_ADDRESS set)
Example fix
// before
var accounts = collection.GetAccounts(); // InteropException with hidden D-Bus error
// after
try { var accounts = collection.GetAccounts(); }
catch (InteropException ex) { Log(ex.InnerException?.Message ?? ex.Message); } Defensive patterns
Strategy: try-catch
Validate before calling
bool SecretServiceAvailable() =>
Environment.GetEnvironmentVariable("DBUS_SESSION_BUS_ADDRESS") != null;
if (!SecretServiceAvailable()) throw new InvalidOperationException("No D-Bus session for Secret Service"); Try / catch
try { return collection.GetAccounts(); }
catch (InteropException ex) { throw new CredentialStoreException($"Keyring search failed: {ex.InnerException?.Message}", ex); } Prevention
- Ensure gnome-keyring/Secret Service is installed and running on target machines
- Always read the inner exception for the real D-Bus error
- Run in a desktop or D-Bus-enabled session when touching the keyring
- Pre-flight check the keyring daemon health at app startup
When it happens
Trigger: GetAccounts() or Get(service/account) when the Secret Service search D-Bus call fails: keyring daemon not running, service locked, schema/attribute mismatch errors returned by the daemon.
Common situations: Running on a system without gnome-keyring or a Secret Service implementation (bare servers, WSL without keyring integration); keyring daemon crashed; searching a collection that does not exist.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Failed to store credentials
- -1
- Failed to erase credentials
- Cannot use the ' ' credential backing store without a…
- Failed to unlock item
AI-assisted analysis of git-ecosystem/git-credential-manager@e8ce762cd0 (2026-09-11).
Data as JSON: /api/errors/cbd665ad035e0f58.
Report an issue: GitHub.
Appendix: source
Thrown at src/Core/Interop/Linux/SecretServiceCollection.cs:79
queryAttrs = CreateSearchQuery(service, account);
SecretSchema schema = GetSchema();
// Execute search query and return all results
results = secret_service_search_sync(
secService,
ref schema,
queryAttrs,
SecretSearchFlags.SECRET_SEARCH_UNLOCK | SecretSearchFlags.SECRET_SEARCH_ALL,
IntPtr.Zero,
out error);
if (error != null)
{
int code = error->code;
string message = Marshal.PtrToStringAuto(error->message)!;
throw new InteropException("Failed to search for credentials", code, new Exception(message));
}
var credentials = new List<ICredential>();
GList* itemPtr = results;
while (itemPtr != null && itemPtr->data != IntPtr.Zero)
{
SecretItem* item = (SecretItem*) itemPtr->data;
// Although we've unlocked the collection during the search call,
// an item can also be individually locked within a collection.
// If the item is locked we should try and unlock it.
if (secret_item_get_locked(item))
{
var toUnlockList = new GList
{
data = (IntPtr) item,
next = IntPtr.Zero,
View on GitHub (pinned to e8ce762cd0)