Subject: bug#77596: Emacs 30.1 secrets.el: Session not automatically re-established after Secret Service restart

From: Michael Albinus <[email-masked]>
Date: Mon, 07 Apr 2025 13:05:45 +0200

spam <[email-masked]> writes:

Hi,

> $ emacs -Q
>
> (require 'secrets nil t)
>
> (secrets-get-secret "Richie" "emacs auth source for org crypt")
>
> "this work's because i had keepassxc open before emacs"
>
> if i restart keepassxc and try again then i get a backtrace
>
> Debugger entered--Lisp error: (dbus-error "org.freedesktop.Secret.Error.NoSession")
>   signal(dbus-error ("org.freedesktop.Secret.Error.NoSession"))
>   dbus-call-method(:session "org.freedesktop.secrets" "/org/freedesktop/secrets/collection/Richie/b25f5d1a9106417492657a0eae1db782" "org.freedesktop.Secret.Item" "GetSecret" :object-path "/")
>   secrets-get-secret("Richie" "emacs auth source for org crypt")
>   (progn (defvar my/ediff-pairs) (defvar my/video-file-regex) (defvar org-planfile) (defvar my/yogadora) (defvar my/yogabuntu) (defvar my/rakmac) (defvar my/oplmac) (defvar my/duckbookpro) (defvar my/yogadows) (secrets-get-secret "Richie" "emacs auth source for org crypt"))
>   eval((progn (defvar my/ediff-pairs) (defvar my/video-file-regex) (defvar org-planfile) (defvar my/yogadora) (defvar my/yogabuntu) (defvar my/rakmac) (defvar my/oplmac) (defvar my/duckbookpro) (defvar my/yogadows) (secrets-get-secret "Richie" "emacs auth source for org crypt")) t)
>   elisp--eval-last-sexp(nil)
>   #f(compiled-function () #<bytecode 0x298d38e0b8462>)()
>   handler-bind-1(#f(compiled-function () #<bytecode 0x298d38e0b8462>) (error) eval-expression--debug)
>   eval-last-sexp(nil)
>   funcall-interactively(eval-last-sexp nil)
>   call-interactively(eval-last-sexp nil nil)
>   command-execute(eval-last-sexp)
>
> the session isn't refreshed. it's stale.

Does it help to re-evaluate secrets.el? Something like

--8<---------------cut here---------------start------------->8---
M-x load-library RET secrets RET
--8<---------------cut here---------------end--------------->8---

Best regards, Michael.