ERROR GET https://lidarr.../api/v1/album: HTTP 500: Sequence contains more than one element
Moving to the unfiltered album endpoint in #2 avoided Lidarr's unguarded
per-artist path, but not the exception underneath it. Every album endpoint maps
through AlbumResource.ToResource, which selects the release with:
var selectedRelease = model.AlbumReleases?.Value.SingleOrDefault(x => x.Monitored);
An album with two monitored releases makes that throw, and the bulk call
loses the entire library to one bad row. The unfiltered endpoint guards the
artist-metadata lookup; it does not guard this.
Change
Keep the unfiltered call as the first attempt -- it is a single request, and it
is still the only path that skips albums whose artist metadata is missing. When
it fails, fall back to one request per artist. That cannot dodge the exception
either, but it confines the loss to whichever artist owns the offending album
and names them in the log, which is the only practical way to find it in a
large library.
Album failures are counted separately from artist failures, because they do not
mean the same thing:
Failure
Effect
Artist's tracks missing
Their played music reads as unplayed. Blocks matching and any cull.
Artist's albums missing
Tracks still index and still match. Blocks only the cull.
Lumping them into one warning would overstate the damage and invite the wrong
fix.
Fixing the data
The log now names the artist. In Lidarr, open them and check the Releases tab
of each album: exactly one release per album may be monitored. Until that is
done, matching works and the cull stays blocked, which is the correct order of
events.
Testing
46 tests, green locally and in docker build --target test. New ones cover the
fallback firing, the offending artist being the only one to lose its albums,
and that artist keeping its tracks -- tracks come from a different endpoint
with a different mapper, so matching survives.
## Problem
ERROR GET https://lidarr.../api/v1/album: HTTP 500: Sequence contains more than one element
Moving to the unfiltered album endpoint in #2 avoided Lidarr's unguarded
per-artist path, but not the exception underneath it. Every album endpoint maps
through `AlbumResource.ToResource`, which selects the release with:
var selectedRelease = model.AlbumReleases?.Value.SingleOrDefault(x => x.Monitored);
An album with **two monitored releases** makes that throw, and the bulk call
loses the entire library to one bad row. The unfiltered endpoint guards the
artist-metadata lookup; it does not guard this.
## Change
Keep the unfiltered call as the first attempt -- it is a single request, and it
is still the only path that skips albums whose artist metadata is missing. When
it fails, fall back to one request per artist. That cannot dodge the exception
either, but it confines the loss to whichever artist owns the offending album
and names them in the log, which is the only practical way to find it in a
large library.
Album failures are counted separately from artist failures, because they do not
mean the same thing:
| Failure | Effect |
| ------------------------ | ------------------------------------------------ |
| Artist's tracks missing | Their played music reads as unplayed. Blocks matching and any cull. |
| Artist's albums missing | Tracks still index and still match. Blocks only the cull. |
Lumping them into one warning would overstate the damage and invite the wrong
fix.
## Fixing the data
The log now names the artist. In Lidarr, open them and check the Releases tab
of each album: exactly one release per album may be monitored. Until that is
done, matching works and the cull stays blocked, which is the correct order of
events.
## Testing
46 tests, green locally and in `docker build --target test`. New ones cover the
fallback firing, the offending artist being the only one to lose its albums,
and that artist keeping its tracks -- tracks come from a different endpoint
with a different mapper, so matching survives.
Fetching every album in one unfiltered request avoided Lidarr's unguarded
per-artist path, but not the exception underneath it. Every album endpoint maps
through AlbumResource.ToResource, which selects the release with
SingleOrDefault(x => x.Monitored). An album with two monitored releases makes
that throw -- "Sequence contains more than one element" -- and the bulk call
loses the entire library to one bad row.
Keep the unfiltered call as the first attempt, since it is a single request and
is still the only path that skips albums whose artist metadata is missing. When
it fails, fall back to one request per artist. That cannot dodge the exception
either, but it confines the loss to whichever artist owns the offending album
and names them, which is the only practical way to find it in a large library.
Album failures are counted separately from artist failures because they do not
mean the same thing. Tracks come from a different endpoint with a different
mapper, so an artist whose albums cannot be fetched still gets indexed and still
matches; it is the cull that cannot run. The report distinguishes the two rather
than lumping them into one warning that overstates the damage.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Problem
Moving to the unfiltered album endpoint in #2 avoided Lidarr's unguarded
per-artist path, but not the exception underneath it. Every album endpoint maps
through
AlbumResource.ToResource, which selects the release with:An album with two monitored releases makes that throw, and the bulk call
loses the entire library to one bad row. The unfiltered endpoint guards the
artist-metadata lookup; it does not guard this.
Change
Keep the unfiltered call as the first attempt -- it is a single request, and it
is still the only path that skips albums whose artist metadata is missing. When
it fails, fall back to one request per artist. That cannot dodge the exception
either, but it confines the loss to whichever artist owns the offending album
and names them in the log, which is the only practical way to find it in a
large library.
Album failures are counted separately from artist failures, because they do not
mean the same thing:
Lumping them into one warning would overstate the damage and invite the wrong
fix.
Fixing the data
The log now names the artist. In Lidarr, open them and check the Releases tab
of each album: exactly one release per album may be monitored. Until that is
done, matching works and the cull stays blocked, which is the correct order of
events.
Testing
46 tests, green locally and in
docker build --target test. New ones cover thefallback firing, the offending artist being the only one to lose its albums,
and that artist keeping its tracks -- tracks come from a different endpoint
with a different mapper, so matching survives.