I tried to use ly.grob-original, though, in the real code it first returned #<Grob Item >.
Namely a dead grob, on which ly:grob-suicide! was called, and on which grob::is-live? will return #f. That's the sort of thing that can happen if your callback gets called after line breaking, at a point where the original has been killed due to break-visibility. Observe: \version "2.23.10" #(define (debug grob) (ly:message "~s ~s" (ly:item-break-dir grob) (ly:grob-original grob))) { \override Staff.BarLine.before-line-breaking = #debug \override Staff.BarLine.after-line-breaking = #debug c'1 }
After some further hours of work, following a different idea, it now displays #<Grob BarLine > (as it should). I'm not able to say what happened, I'm not able to debug because of that unhelpful (oh, I'm very polite this evening) guile messages, see the other thread. I'm overtired like hell, close to trashing the whole project, and close to advertising everyone to not use LilyPond for huge custom codings.
Well, how about rolling up your sleeves and working on that issue with unhelpful messages? See also my recent message to lilypond-devel about the need for help to fix regressions. Best, Jean