File import permanently stuck with 409 registration_recovery_pending — blocks scan, move, AND delete; container restart does not resolve it
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 28/100
調査の方向性
Start by reading FileRegistrationRecoveryService.ReconcileOperationAsync, FileMover.TryAcquireFileMoveGateAsync, and the library API handling for moveRecoveryState; the issue names these entry points but does not identify source files or tests. Trace how SourceDeletionAuthorized journals are reconciled and how pending recovery blocks scan and delete. Done means a supported recovery path safely resolves the stuck journal without silently losing track of leftover source files; add tests for recovery and the affected API operations.
索引モデルが issue の本文から書いたものです。
説明
File import permanently stuck with 409 registration_recovery_pending — blocks scan, move, AND delete; container restart does not resolve it
Summary
For at least one audiobook, a file import/move failed partway through due to
PinnedDirectoryCreation being unable to open a "newly created pinned
directory" (Win32Exception (2): No such file or directory). This left the
audiobook in a registration_recovery_pending state that every
subsequent mutating operation on that audiobook now refuses with 409,
including DELETE — so there is no way to clear the state via the API, and a
container restart (which should trigger the startup recovery reconciler)
reproduces the exact same failure instead of resolving it.
Environment
- Listenarr image:
ghcr.io/listenarrs/listenarr:canary - Deployment: Docker container, library root mounted via SMB/CIFS network
share (host: TrueNAS, mounted into the container as a bind/volume mount) - OS inside container: Linux (Debian-based .NET runtime image)
Steps to reproduce
- Have an audiobook whose files live on an SMB-mounted library root.
- Trigger a file move / download import for that audiobook (either via
POST /api/v1/library/{id}/scan, thePOST /api/v1/library/{id}/move
endpoint, or a normal download-client import). - The move/import fails with a
PinnedDirectoryCreationerror (see log
excerpt below) partway through — apparently after at least one file has
already been committed to the database, but before the whole operation
(including source-file cleanup) has completed. - Every further attempt to touch that audiobook's files now returns:
{ "message": "A committed file import still owns source-cleanup state for this audiobook. Complete that recovery before changing its files.", "code": "registration_recovery_pending" } - This 409 is returned for:
POST /api/v1/library/{id}/scanDELETE /api/v1/library/{id}?deleteFiles=false&deleteFolder=false- A fresh download/import attempt for the same audiobook (retried via
Discord bot re-download) — hits the same pinned-directory error again
duringDownloadProcessingJobProcessor→FileMover.TryAcquireFileMoveGateAsync.
- Restarting the Listenarr container (
docker restart) runs the startup
recovery path again, but it hits the identical pinned-directory error at
startup and does not clear the stuck state:[WRN] [FileMover] Blocked file move because endpoint identity could not be resolved: <source file> -> <dest file>
Log excerpts
Startup (after container restart), recovery reconciler retrying the same move
and failing the same way:
[WRN] [Listenarr.Infrastructure.FileSystem.FileMover] Blocked file move
because endpoint identity could not be resolved: <file>.mp3 -> <file>.mp3
During a fresh download-import retry for the same audiobook:
[WRN] [Listenarr.Infrastructure.FileSystem.FileMover] Blocked file move
because cross-process path locks were unavailable: <file>.mp3 -> <file>.mp3
System.ComponentModel.Win32Exception (2): Could not open a newly created
pinned directory.
at Listenarr.Infrastructure.FileSystem.PinnedDirectoryCreation.OpenDirectoryAtUnix(...)
at Listenarr.Infrastructure.FileSystem.PinnedDirectoryCreation.PinnedDirectoryAnchor.OpenExistingChild(...)
at Listenarr.Infrastructure.FileSystem.PinnedDirectoryCreation.OpenPinnedHierarchyNoFollow(...)
at Listenarr.Infrastructure.FileSystem.FileMover.TryAcquireFileMoveGateAsync(...)
[ERR] [Listenarr.Infrastructure.Downloads.Processing.DownloadProcessingJobProcessor] Error processing download queue
Listenarr.Application.Common.Exceptions.ApplicationConflictException:
A previously committed file import (<guid>) is still retiring its original
source file. Retry after the source file is no longer in use.
at Listenarr.Infrastructure.Persistence.FileRegistrationRecoveryService.ReconcileOperationAsync(...)
Expected behavior
- Either the pinned-directory open should succeed on an SMB-mounted
filesystem (it apparently relies on Unixopenat-style semantics — e.g.
O_NOFOLLOWdirectory-handle chaining — that may not be fully supported by
the SMB/CIFS client used inside the container), or DELETE /api/v1/library/{id}should be able to force-clear a stuck
registration_recovery_pendingstate (withdeleteFiles=false) even if
the underlying recovery can never complete on its own, so a user isn't
permanently locked out of an audiobook record with no escape hatch.
Update: second occurrence + confirmed workaround via direct DB edit
This has now happened to a second, unrelated audiobook on the same
instance, with an identical fingerprint — so this is not a one-off.
Root cause narrowed down
Both times, exactly one row existed in a table called
FileMutationJournals for the affected AudiobookId, and it was the only
row anywhere (MoveJobs and CompatibilityFilePublicationJournals had zero
rows for that audiobook both times). Relevant columns:
OperationId TEXT -- matches the GUID in the "still retiring its original
source file" error message
Action TEXT -- 'Move'
SourcePath TEXT -- the download-client source file
DestinationPath TEXT -- the intended library destination file
State TEXT -- 'SourceDeletionAuthorized' (both occurrences)
AudiobookId INTEGER
State = 'SourceDeletionAuthorized' appears to mean: the move to the
destination was already treated as safe/committed, and the journal is only
waiting on deleting the now-redundant source file — but that last step never
completes (presumably due to the same pinned-directory openat issue on the
SMB source path), and the row is never cleared, which is what keeps
registration_recovery_pending returned forever afterward.
Both times, the DB's AudiobookFiles row for the one "committed" file also
had Size: 64 — same fingerprint as the separate MetadataRescanProcessor
size: 64 issue mentioned below, and both times the destination folder did
not actually exist on disk despite the journal recording a
TargetPhysicalObjectIdentity for it — i.e. the DB's belief that the file
had already landed at the destination did not match reality. The real files
were still sitting untouched in the download-client's completed folder.
Workaround that resolved it (destructive to the journal only, not to any media file)
- Take a straight file-copy backup of
/app/config/database/listenarr.db
first. DELETE FROM FileMutationJournals WHERE OperationId = '<guid>' AND AudiobookId = <id>viasqlite3/python3 sqlite3while the container
keeps running (WAL mode tolerated this fine both times).- This alone made
POST /api/v1/library/{id}/scanstop returning
registration_recovery_pending— but since the files weren't actually at
the destination yet, it then returned a different409:
{"message":"Scan path identity could not be established safely","reason":"IdentityUnavailable"}
for a folder that doesn't exist. That's a separate, expected failure mode,
not a regression from the fix. - Manually copying/moving the real files from the download-client's folder
into the expected library destination path (matching Listenarr's own
naming convention) and then callingPOST /api/v1/library/{id}/scan
again completed successfully both times and picked up all files (9/9 and
215/215 respectively).
Suggested fix / feature request
Given the pattern is so specific and mechanical, it seems like a good
candidate for a proper, supported recovery action rather than requiring
manual SQLite surgery:
- A
POST /api/v1/library/{id}/moveRecoveryState/abandon(or similar)
endpoint that, given operator confirmation, marks a
SourceDeletionAuthorized(or any terminal-but-stuck)FileMutationJournal
row as resolved without needing the actual filesystem delete to succeed —
i.e., "I know the source cleanup didn't happen, I'll deal with the leftover
file myself, just stop blocking this audiobook." - Alternatively,
DELETE /api/v1/library/{id}could be allowed to proceed
(withdeleteFiles=false) even while a recovery is pending, since deleting
the Listenarr record shouldn't require completing filesystem cleanup of
an unrelated source file outside the library root.
Additional notes
- No API endpoint appears to exist to manually resolve/abandon a stuck
per-audiobookregistration_recovery_pending/move_recovery_required
state (onlyGET /api/v1/library/{id}/moveRecoveryStateto inspect it,
andRequeueMoveJob/RequeueScanJob, which just retry the same failing
operation). - This may be the same underlying SMB-compatibility issue as the periodic
MetadataRescanProcessorwarnings we also see in the logs
(Failed to rescan metadata for file id=.../
Could not open a newly created pinned directory), which leave freshly
scanned files withsize: 64in the DB instead of their real size — same
PinnedDirectoryCreation.OpenDirectoryAtUnixstack. - Happy to provide the full startup log, the exact audiobook ID, and DB
schema details if useful — this is a homelab instance running against a
TrueNAS SMB share.
- 主要言語
- C#
- スター
- 901
- フォーク
- 70
- 平均マージ
- 16時間 27分
- マージ済み PR(30日)
- 60
環境構築
- Dockerfile または Docker Compose ファイルあり
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
Listenarrs/Listenarr のほかの issue
-
Search button on a book does not retry without the author when the full query finds nothing対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
Listenarrs/Listenarr#1173 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
Listenarrs/Listenarr#1133 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Listenarrs/Listenarr#1128 ·
メンテナーはふだん 1 日以内に返信
-
Add New's search splits a title that contains "Series:", "Author:"… as if they were search keywordsオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
Listenarrs/Listenarr#1127 ·
メンテナーはふだん 1 日以内に返信
-
p3
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
Listenarrs/Listenarr#971 ·
メンテナーはふだん 1 日以内に返信
Listenarrs/Listenarr の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
conductor-oss/csharp-sdk#183 ·
-
CreateNewLangProj throws when the default analysis writing system's ICU locale differs from its tagオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
-
kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
unoplatform/uno#26555 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
CactuseSecurity/firewall-orchestrator#5739 ·
メンテナーはふだん 1 日以内に返信
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信