Invalid index: out of bounds

I am new to Shiny, Please assist.

sentiment_score <- reactive({
    progress <- shiny::Progress$new()
    progress$set(message = "Working on Sentiment", value = 0)
    on.exit(progress$close())
    
    x <- data.frame(tweet_nbr = 1:length(cleaned_tweets()), clean_tweet = cleaned_tweets())
    x$clean_tweet <- as.character(x$clean_tweet)
    
    progress$set(detail = "Getting score...", value = 0.6)
    df <- x  %>% unnest_tokens(output = word, input = clean_tweet, token = "words")
    df <- df %>% inner_join(get_sentiments("afinn"))
    df <- df %>% group_by(tweet_nbr) %>% summarize(score = n())
    
    progress$set(detail = "Getting score...", value = 0.8)
    df$category_senti <- ifelse(df$score < 0, "Negative", ifelse(df$score > 0, "Positive", "Neutral"))
    df1 <- df %>% left_join(x)
    
    x <- list()
    x[[1]] <- as.data.frame(df1)
    x[[2]] <- as.character(df1[df1$score == max(df1$score),"clean_tweet"][1,1])
    x[[3]] <- as.character(df1[df1$score == min(df1$score),"clean_tweet"][1,1])
    
    x
  })
#> Error in reactive({: could not find function "reactive"
  
  senti_df <- reactive({
    sentiment_score()[[1]] %>% group_by(category_senti) %>% summarise(score = n()) %>% 
      mutate(score_pct = score/sum(score)*100, coloract = c("#d35400", "#2980b9", "#2ecc71"))
  })
#> Error in reactive({: could not find function "reactive"
  
  output$sentiment_plot <- renderHighchart(
    
    hc <- highchart() %>%
      #hc_title(text = "Incremental Revenue and Total Cost by Offer Group") %>%
      hc_chart(type = "bar") %>%
      #hc_plotOptions(bar = list(getExtremesFromAll = T)) %>% 
      hc_tooltip(crosshairs = TRUE, shared = FALSE,useHTML=TRUE,
                 formatter = JS(paste0("function() {
                                       console.log(this.point.y);
                                       var result='';
                                       result='<br/><span style=\\'color:'+this.series.color+'\\'>'+this.series.name+'</span>:<b> '+Math.round(this.point.y.toFixed(0))/1 + '%' + '</b>';
                                       return result;
                   }")))%>%
      hc_xAxis(categories = senti_df()$category_senti,
               #labels = list(rotation = 0, step=1), title =list(text="Brand")
               labels = list(style = list(fontSize= '12px')) #max=20, scrollbar = list(enabled = T)
      )    %>%
      hc_colors(colors = senti_df()$coloract) %>% 
      hc_add_series(name="Sentiment", data = senti_df()$score_pct, colorByPoint = TRUE, 
                    type ="column",
                    #max=max(d()$freq), tickInterval = max(d()$freq)/4, alignTicks = F,
                    color = "#4472c4", showInLegend= F) %>% 
      hc_yAxis(labels=list(format = '{value}%'),min=0,
               max=100,showFirstLabel = TRUE,showLastLabel=TRUE)
    #hc_legend(layout = "vertical", align = "right", verticalAlign = "top", width=120, itemStyle = list(fontSize= '10px'))
  )

If you want to use reactive() rather than shiny::reactive() then you should use library(shiny) in your code. Also all the reactive's should be happening within a server function.