Skip to content

[BUG] [Lidarr] "integer expression expected" from pyxdameraulevenshtein calls using 'python' instead of 'python3' #408

@barrettclark

Description

@barrettclark

Description

The fuzzy album title matching calls in Audio.service.bash use python -c to invoke pyxdameraulevenshtein. On modern systems (including the linuxserver.io Alpine-based container), python may not be available or may not be symlinked to Python 3. When the call fails silently (due to 2>/dev/null), $diff is set to an empty string, and the subsequent integer comparison fails:

./run: line 1495: [: : integer expression expected

This was previously reported in #180 and closed as user error, but the root cause is in the script itself.

Root Cause

File: lidarr/Audio.service.bash, lines 1347, 1502, and 1610

All three occurrences use python -c instead of python3 -c:

diff=$(python -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; print(damerau_levenshtein_distance(\"${lidarrAlbumReleaseTitleClean,,}\", \"${deezerAlbumTitleClean,,}\"))" 2>/dev/null)
if [ "$diff" -le "$matchDistance" ]; then

When python is unavailable or doesn't have pyxdameraulevenshtein, the command fails silently, $diff is empty, and [ "" -le "3" ] throws integer expression expected.

Symptoms

  • ./run: line 1495: [: : integer expression expected in container logs
  • Rapid infinite loop: albums cycle between "Getting Album info" and "Album info downloaded and verified" without ever matching or skipping
  • No Deezer album downloads succeed — every album hits the retry loop
  • Heavy log spam for every missing album

Fix

Change all three occurrences from python -c to python3 -c:

Line 1347 (ArtistDeezerSearch):

diff=$(python3 -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; ..." 2>/dev/null)

Line 1502 (TidalArtistSearch):

diff=$(python3 -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; ..." 2>/dev/null)

Line 1610 (TidalAlbumSearch):

diff=$(python3 -c "from pyxdameraulevenshtein import damerau_levenshtein_distance; ..." 2>/dev/null)

pyxdameraulevenshtein is already correctly installed by setup.bash via uv pip install. The fix is simply using the correct interpreter name.

Environment

  • arr-scripts v2.48
  • linuxserver/lidarr container (Alpine-based)
  • Python 3.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions