grosser/parallel_tests · error · RuntimeError

Could not find #{specified_specs_not_found} from --specify-g

Error message

Could not find #{specified_specs_not_found} from --specify-groups in the selected files & folders

What it means

Every comma-separated entry in --specify-groups is matched by exact string equality against the test file paths parallel_tests discovered under the selected folders. Any entry that matches nothing -- typo, bare filename instead of the discovered path, absolute vs relative mismatch, or a file filtered out by --pattern/--exclude-pattern/--suffix -- is reported by this raise from Grouper.specify_groups.

Source

Thrown at lib/parallel_tests/grouper.rb:69

      def specified_groups(options)
        groups = options[:specify_groups]
        return groups if groups != '-'

        $stdin.read.chomp
      end

      def specify_groups(items, num_groups, options, groups)
        specify_test_process_groups = specified_groups(options).split('|')
        if specify_test_process_groups.count > num_groups
          raise 'Number of processes separated by pipe must be less than or equal to the total number of processes'
        end

        all_specified_tests = specify_test_process_groups.map { |group| group.split(',') }.flatten
        specified_items_found, items = items.partition { |item, _size| all_specified_tests.include?(item) }

        specified_specs_not_found = all_specified_tests - specified_items_found.map(&:first)
        if specified_specs_not_found.any?
          raise "Could not find #{specified_specs_not_found} from --specify-groups in the selected files & folders"
        end

        if specify_test_process_groups.count == num_groups && items.flatten.any?
          raise(
            <<~ERROR
              The number of groups in --specify-groups matches the number of groups from -n but there were other specs
              found in the selected files & folders not specified in --specify-groups. Make sure -n is larger than the
              number of processes in --specify-groups if there are other specs that need to be run. The specs that aren't run:
              #{items.map(&:first)}
            ERROR
          )
        end

        # First order the specify_groups into the main groups array
        specify_test_process_groups.each_with_index do |specify_test_process, i|
          groups[i] = specify_test_process.split(',')
        end

View on GitHub (pinned to a06047856d)

Solutions

  1. List what parallel_tests actually found (run once with --verbose, or `find spec -name '*_spec.rb'`) and copy the exact relative paths
  2. Verify every entry exists before running: `specs.all? { |p| File.exist?(p) }`
  3. Check that --pattern/--exclude-pattern/--suffix are not filtering the listed files, and run from the repo root so relative paths line up

Example fix

# before
parallel_test --specify-groups 'user_spec.rb|auth_spec.rb'

# after
parallel_test --specify-groups 'spec/models/user_spec.rb|spec/requests/auth_spec.rb'
Defensive patterns

Strategy: validation

Validate before calling

groups = 'spec/models/user_spec.rb|spec/requests/auth_spec.rb'
missing = groups.split(/[|,]/).reject { |p| File.exist?(p) }
abort "--specify-groups entries not found: #{missing.join(', ')}" if missing.any?

Type guard

def specify_groups_resolvable?(spec_string)
  spec_string.split(/[|,]/).all? { |p| File.exist?(p) }
end

Try / catch

begin
  ParallelTests::CLI.new.run(args)
rescue RuntimeError => e
  if e.message.include?('--specify-groups')
    # entries went stale: re-list discovered files and diff against the pinned list
    abort "stale --specify-groups: #{e.message}"
  else
    raise
  end
end

Prevention

When it happens

Trigger: `parallel_test --specify-groups 'user_spec.rb|auth_spec.rb'` when the discovered paths are spec/models/user_spec.rb etc.; renaming or moving a spec after hardcoding the group list; running from a different working directory; the listed file being excluded by -p/--exclude-pattern or not matching the test-file suffix.

Common situations: Pinned-group lists in CI rot as files move; paths copied from an editor (absolute) while discovery produced relative paths; a narrower folder argument filtering out files the group list assumes are present.

Related errors


AI-assisted analysis of grosser/parallel_tests@a06047856d (2026-08-23). Data as JSON: /api/errors/0c50b22905dda64d. Report an issue: GitHub.