Run Code Node Fails with Generic Error - Likely Missing Libraries

Hi Gumloop Community,

I’m using the “Run Code” node to scrape meta-titles and meta-descriptions from URLs of webpages, but I’m getting this error:

Loading https://shop.mmtcpamp.com/silver/silver-coin
https://www.tanishq.co.in/product/10-gram-999-purity-silver-coin-800102zlaaba00.html from storage.
Run Code Failed!
There was an error in your Run Code node.

def function(gettitle_desc):
    import requests
    from bs4 import BeautifulSoup

    urls = gettitle_desc.split(",")
    urls = [url.strip() for url in urls]
    results = []
    headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"}

    for url in urls:
        try:
            response = requests.get(url, headers=headers, timeout=10)
            if response.status_code == 200:
                soup = BeautifulSoup(response.content, 'html.parser')
                meta_title = soup.title.string if soup.title else "Not found"
                meta_description_tag = soup.find("meta", attrs={"name": "description"})
                meta_description = meta_description_tag["content"] if meta_description_tag else "Not found"
            else:
                meta_title = "Error"
                meta_description = f"HTTP Error {response.status_code}"
            results.append({"url": url, "meta_title": meta_title, "meta_description": meta_description})
        except Exception as e:
            results.append({"url": url, "meta_title": "Error", "meta_description": f"Error: {str(e)}"})

    return results

Setup:

  • Input: gettitle_desc mapped to data[0].Urls List from “Google Sheets Reader”.
  • Output: results.

I suspect the error is due to missing requests and beautifulsoup4 libraries. Are these available in the “Run Code” node? If not, how can I request them? Should I use the “Web Agent Scraper” node instead?

Appreciate your help . Thanks!

Sharing my workbook with you guys
https://www.gumloop.com/pipeline?workbook_id=jrK1CgR8bQao9FP6sLV7i9

Hey @la_pranav! If you’re reporting an issue with a flow or an error in a run, please include the run link and make sure it’s shareable so we can take a look.

  1. Find your run link on the history page. Format: https://www.gumloop.com/pipeline?run_id={your_run_id}&workbook_id={workbook_id}

  2. Make it shareable by clicking “Share” → ‘Anyone with the link can view’ in the top-left corner of the flow screen.
    GIF guide

  3. Provide details about the issue—more context helps us troubleshoot faster.

You can find your run history here: https://www.gumloop.com/history

Hey @la_pranav – Can you share the failed run link as well so I view the inputs/outputs please? You can find the run link on the https://www.gumloop.com/history page or through the Previous Runs tab on the canvas.

Also, you can check the full list of available libraries here: Run Code - Gumloop

Hey @Wasay-Gumloop I am sharing the previous failed run link ,please let me know if it’s working or if you need something more
Previous failed run link
https://www.gumloop.com/pipeline?run_id=iKavPbi7fTvoq5VEb6s5eQ&workbook_id=jrK1CgR8bQao9FP6sLV7i9

Thank you @la_pranav – We’re going to investigate this further. In the meantime could you try using a custom node for this, that should work.

Doc: https://blog.gumloop.com/gumloop-custom-nodes/
Video Tutorial: https://www.youtube.com/watch?v=yHjxbmdg-cI&ab_channel=Gumloop
Custom Node Workshop: https://www.youtube.com/watch?v=ovCCWfgWv4M

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.