Skip to content

[BUG] NZBGet imports never run — GetImportItemAsync keeps the stale intermediate ContentPath instead of resolving the final path from history #652

@NiCADitO

Description

@NiCADitO

Summary

With NZBGet (separate InterDir configured), every completed download fails to import. Files land in completed/, but Listenarr keeps scanning the intermediate/<name>.#NZBID working dir — which is deleted after completion — so it never imports and the Activity entry stays stuck. No remote path mapping (so not #486).

Environment

  • Listenarr canary (reproduced on HEAD / v1.0.6)
  • NZBGet (LinuxServer): DestDir=.../completed, InterDir=.../intermediate
  • Listenarr + NZBGet share /data:/data; no remote path mapping
  • Deterministic, reproduced on 4 titles

Symptom

[WRN] DownloadClientGateway: reported no source files and content path scanning failed
for item Brian.Jacques-Redwall.21-The.Sable.Quean... with path
/data/downloads/nzbget/intermediate/...#125/...

File is actually at /data/downloads/nzbget/completed/.../The Sable Quean.m4b.

Root cause

GetImportItemAsync (listenarr.infrastructure/Adapters/NzbgetAdapter.cs, ~line 1032) returns early on a non-empty ContentPath without checking it exists:

// If ContentPath is already set and exists, use it
if (!string.IsNullOrEmpty(result.ContentPath))
{
    return result;
}

The comment says "and exists," but there's no existence check. MapGroup (~line 755) has already set ContentPath from the active group's DestDir, which for an in-progress NZBGet group is the intermediate working dir. So this early return hands back the stale path and the history FinalDir/DestDir resolution just below (~lines 1063–1065) never runs. After completion the intermediate dir is gone, the gateway's Directory.EnumerateFiles throws, and import fails.

Fix

if (!string.IsNullOrEmpty(result.ContentPath) &&
    (File.Exists(result.ContentPath) || Directory.Exists(result.ContentPath)))
{
    return result;
}

Now the stale path fails the guard, execution falls through to the history lookup, ContentPath resolves to completed/<name>, and import proceeds.

Note: clearing InterDir is not a workaround — NZBGet still uses a .#NZBID temp dir that's renamed on completion, so the early return still returns a stale path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions