Radarr/Radarr · error · BadRequestException

movieId or movieFileIds must be provided

Error message

movieId or movieFileIds must be provided

What it means

Thrown by GET /api/v3/movieFile when neither the movieId nor the movieFileIds query parameter is supplied. The endpoint returns movie files either by movie or by file id, so at least one selector is mandatory; the guard rejects an ambiguous 'return everything' call.

Source

Thrown at src/Radarr.Api.V3/MovieFiles/MovieFileController.cs:67

        }

        protected override MovieFileResource GetResourceById(int id)
        {
            var movieFile = _mediaFileService.GetMovie(id);
            var movie = _movieService.GetMovie(movieFile.MovieId);

            var resource = movieFile.ToResource(movie, _upgradableSpecification, _formatCalculator);

            return resource;
        }

        [HttpGet]
        [Produces("application/json")]
        public List<MovieFileResource> GetMovieFiles([FromQuery(Name = "movieId")] List<int> movieIds, [FromQuery] List<int> movieFileIds)
        {
            if (!movieIds.Any() && !movieFileIds.Any())
            {
                throw new BadRequestException("movieId or movieFileIds must be provided");
            }

            var movieFiles = movieIds.Any()
                ? _mediaFileService.GetFilesByMovies(movieIds)
                : _mediaFileService.GetMovies(movieFileIds);

            if (movieFiles == null)
            {
                return new List<MovieFileResource>();
            }

            return movieFiles.GroupBy(e => e.MovieId)
                .SelectMany(f => f.ToList()
                    .ConvertAll(e => e.ToResource(_movieService.GetMovie(f.Key), _upgradableSpecification, _formatCalculator)))
                .ToList();
        }

        [RestPutById]

View on GitHub (pinned to ca451608dc)

Solutions

  1. Append at least one selector: ?movieId=1 or ?movieFileIds=10&movieFileIds=11.
  2. Confirm you are using the exact query parameter names expected by the endpoint (movieId for movies, movieFileIds for files).

Example fix

// before
GET /api/v3/movieFile
// after
GET /api/v3/movieFile?movieId=42
Defensive patterns

Strategy: validation

Validate before calling

if (movieIds.Count == 0 && movieFileIds.Count == 0) {
    return BadRequest("Provide movieId or movieFileIds.");
}

Type guard

static bool HasSelector(List<int> movieIds, List<int> movieFileIds)
    => movieIds?.Any() == true || movieFileIds?.Any() == true;

Prevention

When it happens

Trigger: A GET /api/v3/movieFile with no query string, or with neither movieId nor movieFileIds present.

Common situations: A client/script that forgot to append a filter; a UI code path that calls the endpoint before a selection is made; a malformed query string where the parameter names don't match (movieId vs movieIds).

Related errors


AI-assisted analysis of Radarr/Radarr@ca451608dc (2026-08-13). Data as JSON: /api/errors/b4d87d20d67f3f56. Report an issue: GitHub.