I can't test as you didn't provide a reprex, so this is my best guess.
Option 1: I'm pretty sure in the formula you can't use $ to access columns, you need to use the form from option 2, providing the data in the data argument, and using the column names directly in the formula.
Option 2: note the error message argument 'x' is missing. And indeed, if you look at ?aggregate, you can find its usage:
## S3 method for class 'formula'
aggregate(x, data, FUN, ...,
subset, na.action = na.omit)
So even if you provide a formula, the argument name is x. You need to call it as:
counts <- aggregate(x = ride_length ~ member_casual + day_of_week,
data = all_trips_v2,
FUN = mean)
or using a positional argument (not specifying the name):
counts <- aggregate(ride_length ~ member_casual + day_of_week,
data = all_trips_v2,
FUN = mean)
The error message explains why your code might have worked in the past: argument 'x' is missing -- it has been renamed from 'formula'. So in older versions of R, this argument was indeed called formula, and your option 2 would have worked. If you're curious, you can find that this change was introduced in R 4.2.0 because the old name was creating a problem.