Skip to content

fix(lidarr): send artistId (singular) so ArtistSearch actually runs - #17

Open
Germwalker wants to merge 1 commit into
elfhosted:mainfrom
Germwalker:fix/lidarr-artist-search-id
Open

fix(lidarr): send artistId (singular) so ArtistSearch actually runs#17
Germwalker wants to merge 1 commit into
elfhosted:mainfrom
Germwalker:fix/lidarr-artist-search-id

Conversation

@Germwalker

Copy link
Copy Markdown

Problem

Lidarr's missing-mode artist never triggers a real search. Every ArtistSearch command is silently rejected by Lidarr, while Newtarr logs it as a success.

In src/primary/apps/lidarr/api.py, the command payload is built with a plural key:

payload = {
    "name": "ArtistSearch",
    "artistIds": [artist_id]
}

Lidarr's ArtistSearchCommand exposes a single integer field, ArtistId — there is no ArtistIds. Lidarr's JSON deserializer ignores the unknown key, ArtistId keeps its default value of 0, and the command fails at execution time:

NzbDrone.Core.Datastore.ModelNotFoundException: Artist with ID 0 does not exist
   at NzbDrone.Core.IndexerSearch.ReleaseSearchService.ArtistSearch(Int32 artistId, ...)

Newtarr never sees this: POST /api/v1/command returns 201 with a command id, so it logs Triggered Lidarr ArtistSearch for artist ID: 1261 and moves on. The failure happens later, when Lidarr executes the queued command. The artist id is computed correctly — it is only lost when the payload is built.

The same file already uses the singular form correctly elsewhere (params['artistId'] = artist_id, line 195), which suggests a typo rather than a deliberate choice. search_albums() is unaffected: it sends albumIds, which does match AlbumSearchCommand.AlbumIds (a List<int>).

Fix

Send the field Lidarr actually declares.

Verification

Applied on a live instance (Lidarr, 3546 artists, ~57k missing albums).

Before — 30 of 30 searches per cycle failed, none reached an indexer:

10:33:11 |Error|CommandExecutor|Error occurred while executing task ArtistSearch
          ModelNotFoundException: Artist with ID 0 does not exist   (x30)

After — searches reach the indexers:

10:49:29 |Info|ReleaseSearchService|Searching indexers for [Nathaniel Rateliff]. 14 active indexers

No further Artist with ID 0 entries after the restart.

Impact

Anyone running Newtarr against Lidarr with hunt_missing_mode: "artist" gets zero results while the logs report normal operation. The bug predates this fork — the same line is present in the upstream Huntarr code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LMKFGWjW2FQSQPCcQ4mWLC

Lidarr's ArtistSearchCommand declares a single integer field, ArtistId.
Sending "artistIds": [id] makes Lidarr ignore the unknown key, leaving
ArtistId at its default of 0, and the queued command then fails with
ModelNotFoundException: Artist with ID 0 does not exist.

The POST returns 201, so Newtarr logs the search as triggered while no
search ever reaches an indexer. Verified on a live instance: 30/30
failures per cycle before, real indexer searches after.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LMKFGWjW2FQSQPCcQ4mWLC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant