Skip to content

API 500: not_expected endpoint crashes when split_name param is missing #2224

Description

@moveson

Error

Scout error group 123521 (production, 2026-08-18 17:38 UTC, 1 occurrence):

NoMethodError: undefined method 'parameterize' for nil

Request: GET https://www.opensplittime.org/api/v1/event_groups/1088/not_expected

Cause

Api::V1::EventGroupsController#not_expected passes params[:split_name] straight to FindNotExpectedBibs, whose initializer calls split_name.parameterize unguarded (app/services/find_not_expected_bibs.rb:13). When the client omits split_name, the call crashes with a 500 before the service's own validation can run.

Expected behavior

A missing or unknown split name should produce the service's normal 422 response ("invalid split name" via validate_setup), not a 500. A minimal fix is split_name.to_s.parameterize (an empty string then fails the existing inclusion validation naturally).

🤖 Generated with Claude Code

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions