Undefined slice error this weekend when running script

I tried to make a “collect all website links agent” using a scraper + python script, but I get this error:

I let the “Generate” button create this script for me:

import re
from typing import List, Tuple

def extract_urls(text: str) -> List[str]:
    """Extract URLs from text using regex pattern matching."""
    if not isinstance(text, str):
        text = str(text)
        
    # Use regex to find all URLs
    pattern = r'(https?://\S+|www\.\S+)'
    urls = re.findall(pattern, text)
    
    # Clean URLs by removing trailing punctuation
    cleaned_urls = []
    for url in urls:
        # Remove trailing punctuation
        url = re.sub(r'[.,!?]+$', '', url)
        cleaned_urls.append(url)
        
    return cleaned_urls

def extract_and_process_urls() -> None:
    """Main function to extract and process URLs from text."""
    
    # Get input text from specified variable
    input_text = ai.getConfig("inputVariable")
    if not input_text:
        print("No input text provided")
        # Set empty outputs
        ai.vars[ai.getConfig("urlsOutputVariable")] = ""
        ai.vars[ai.getConfig("countOutputVariable")] = 0
        return
        
    # Extract URLs
    urls = extract_urls(input_text)
    
    # Remove duplicates while preserving order
    seen = set()
    unique_urls = []
    for url in urls:
        if url not in seen:
            unique_urls.append(url)
            seen.add(url)
            
    # Create CSV string
    csv_output = "\n".join(unique_urls)
    
    # Store outputs in specified variables
    ai.vars[ai.getConfig("urlsOutputVariable")] = csv_output
    ai.vars[ai.getConfig("countOutputVariable")] = len(unique_urls)
    
    print(f"Found {len(unique_urls)} unique URLs")

# Execute the function
extract_and_process_urls()

I tried creating different scripts with python and javascript but they all ran into a similar wierd error. Each of them mentioned a “slice”, whatever that means. :person_shrugging: