You want Year to be treated as a discrete label but R thinks it is a continuous numeric value. You can make it discrete by making it a factor. The code below reproduces your error and then fixes it with the factor() function.
library(ggplot2)
DF <- data.frame(X = rep(1:5,2), Y = c(11:15, 21:25),
Year = rep(c(2020, 2021), each = 5))
ggplot(DF, aes(X, Y, color = Year)) + geom_point() +
scale_color_manual(values = c("2020" = "red", "2021" = "blue"))
#> Error: Continuous value supplied to discrete scale
DF$Year = factor(DF$Year)
ggplot(DF, aes(X, Y, color = Year)) + geom_point() +
scale_color_manual(values = c("2020" = "red", "2021" = "blue"))

Created on 2022-05-02 by the reprex package (v2.0.1)