Skip to content

fix(api): add a migration script to rename *arr tags with spaces#1946

Merged
gauthier-th merged 2 commits intodevelopfrom
arr-tags
Oct 1, 2025
Merged

fix(api): add a migration script to rename *arr tags with spaces#1946
gauthier-th merged 2 commits intodevelopfrom
arr-tags

Conversation

@gauthier-th
Copy link
Copy Markdown
Member

@gauthier-th gauthier-th commented Sep 30, 2025

Description

This PR adds a migration script that will run at the startup of the app to remove the spaces from the *arr tags of Jellyseerr.

To-Dos

  • Disclosed any use of AI (see our policy)
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

Issues Fixed or Closed

This PR adds a migration script that will run at the startup of the app to remove the spaces from
the *arr tags of Jellyseerr.

fix #1897
re #1913
re Radarr/Radarr#11251
fallenbagel
fallenbagel previously approved these changes Sep 30, 2025
Copy link
Copy Markdown
Collaborator

@fallenbagel fallenbagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Didnt test

@fallenbagel
Copy link
Copy Markdown
Collaborator

fallenbagel commented Sep 30, 2025

I'm gonna try something. For testing and research purposes. Excuse me for the spam

@fallenbagel fallenbagel requested a review from Copilot September 30, 2025 12:01
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a migration script to automatically rename *arr (Radarr/Sonarr) tags that contain spaces in their user ID format, changing from {user.id} - to {user.id}- format to resolve compatibility issues with *arr applications.

  • Adds a new migration script that runs at startup to update existing tag formats
  • Implements a renameTag method in the ServarrBase API class
  • Updates the settings interface to track completed migrations

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
server/lib/settings/migrations/0007_migrate_arr_tags.ts New migration script that renames user tags by removing spaces from the format
server/lib/settings/index.ts Adds migrations tracking to settings interface and default configuration
server/api/servarr/base.ts Implements renameTag API method for updating tag labels

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@gauthier-th
Copy link
Copy Markdown
Member Author

Didnt test

Did a small test on a test instance, went well. Will test later on my prod instance.

@gauthier-th gauthier-th added the preview PRs deployed for testing with tag `:preview-prxx` label Sep 30, 2025
@gauthier-th
Copy link
Copy Markdown
Member Author

Preview tag: preview-rename-tags

@gauthier-th
Copy link
Copy Markdown
Member Author

Tested in prod and works well

@gauthier-th gauthier-th merged commit f2bd0ab into develop Oct 1, 2025
12 checks passed
@gauthier-th gauthier-th deleted the arr-tags branch October 1, 2025 09:42
@v3DJG6GL
Copy link
Copy Markdown

v3DJG6GL commented Dec 9, 2025

I found a possible issue with this PR:
while Seerr is starting, I can see these logs:

2025-12-09T17:35:39.614Z [debug][Settings Migrator]: Checking migration '0007_migrate_arr_tags.js'... 
Unable to rename Radarr tags to the new format. Please check your Radarr connection settings for the instance "Radarr". [Radarr] Failed to rename tag: Request failed with status code 400

Radarr (v6) is logging these lines:

2025-12-09 18:35:39.6|Debug|Api|[GET] /api/v3/tag?apikey=(removed) 200.OK (4 ms)
2025-12-09 18:35:39.7|Warn|RadarrErrorPipeline|Invalid request Validation failed: 
 -- Label: Allowed characters a-z, 0-9 and -
2025-12-09 18:35:39.7|Debug|Api|[PUT] /api/v3/tag/22?apikey=(removed) 400.BadRequest (98 ms)

Sonarr (v4) is logging these lines:

2025-12-09 18:35:39.7|Debug|Sonarr.Http.Authentication.ApiKeyAuthenticationHandler|AuthenticationScheme: API was successfully authenticated.
2025-12-09 18:35:39.7|Debug|Api|[GET] /api/v3/tag?apikey=(removed) 200.OK (2 ms)

The tags in Sonarr (which is still on v4 and thus unaffected from these recent enforced naming rules) are renamed, while in Radarr the tags rely unchanged.
However, only the first two occurrences of a spaces is removed from the Sonarr tags
Initially my tags looked like this:

12 - noam meyer

now they are renamed to:

12-noam meyer

Since tags with spaces are not prohibited in Sonarr v4, renaming works. However, since only the first two spaces and not all subsequent spaces are removed during migration, Radarr v6 blocks these renames.

@gauthier-th
Copy link
Copy Markdown
Member Author

I found a possible issue with this PR: while Seerr is starting, I can see these logs:

2025-12-09T17:35:39.614Z [debug][Settings Migrator]: Checking migration '0007_migrate_arr_tags.js'... 
Unable to rename Radarr tags to the new format. Please check your Radarr connection settings for the instance "Radarr". [Radarr] Failed to rename tag: Request failed with status code 400

Radarr (v6) is logging these lines:

2025-12-09 18:35:39.6|Debug|Api|[GET] /api/v3/tag?apikey=(removed) 200.OK (4 ms)
2025-12-09 18:35:39.7|Warn|RadarrErrorPipeline|Invalid request Validation failed: 
 -- Label: Allowed characters a-z, 0-9 and -
2025-12-09 18:35:39.7|Debug|Api|[PUT] /api/v3/tag/22?apikey=(removed) 400.BadRequest (98 ms)

Sonarr (v4) is logging these lines:

2025-12-09 18:35:39.7|Debug|Sonarr.Http.Authentication.ApiKeyAuthenticationHandler|AuthenticationScheme: API was successfully authenticated.
2025-12-09 18:35:39.7|Debug|Api|[GET] /api/v3/tag?apikey=(removed) 200.OK (2 ms)

The tags in Sonarr (which is still on v4 and thus unaffected from these recent enforced naming rules) are renamed, while in Radarr the tags rely unchanged. However, only the first two occurrences of a spaces is removed from the Sonarr tags Initially my tags looked like this:

12 - noam meyer

now they are renamed to:

12-noam meyer

Since tags with spaces are not prohibited in Sonarr v4, renaming works. However, since only the first two spaces and not all subsequent spaces are removed during migration, Radarr v6 blocks these renames.

Good catch thanks. I'll make a PR to fix that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

preview PRs deployed for testing with tag `:preview-prxx`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tag Requests should not contain spaces per Sonarr and Radarr specifications

5 participants