crewAIInc / crewAIInc/crewAI

[BUG] YoutubeChannelSearchTool rejects documented YouTube channel handle in v1.15.21

Open
#7,404 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Python
Stars
58.8k
Forks
8.5k
Avg merge
1d 15h
Merged PRs (30d)
109

Description

Description

The YoutubeChannelSearchTool fails when using a valid YouTube channel handle as documented in the CrewAI v1.15.21 documentation.

The documentation shows that the tool can be initialized using a channel handle such as:

youtube_channel_handle="@exampleChannel"

However, with crewai==1.15.21 and crewai-tools==1.15.21, using a valid channel handle results in:

ValueError: Invalid YouTube channel URL: @exampleChannel

The error occurs inside YoutubeChannelLoader because the loader expects a URL containing "youtube.com/...", while YoutubeChannelSearchTool passes the handle to the RAG adapter.

I also tested passing a full YouTube channel URL, but this is not a workaround because YoutubeChannelSearchTool.add() prepends "@" to values that do not start with "@", resulting in a malformed value.

This eventually causes the YouTube loader/pytube integration to fail.

Steps to Reproduce
  1. Run Python 3.13

  2. Install CrewAI and CrewAI Tools:

pip install crewai==1.15.21 crewai-tools==1.15.21

  1. Import the YouTube channel search tool:

from crewai_tools import YoutubeChannelSearchTool

  1. Initialize it with a documented channel handle:

youtube_channel_tool = YoutubeChannelSearchTool(
youtube_channel_handle="@handle"
)

  1. The tool initialization fails with:

ValueError: Invalid YouTube channel URL: @handle

  1. Passing a full YouTube channel URL also fails because the add() method prepends @ to the URL.
Expected behavior

A valid YouTube channel handle provided in the documented @handle format should be accepted by YoutubeChannelSearchTool.

The tool should resolve the handle to the corresponding YouTube channel URL and successfully load the channel content.

Screenshots/Code snippets

from crewai_tools import YoutubeChannelSearchTool

youtube_channel_tool = YoutubeChannelSearchTool(
youtube_channel_handle="@handle"
)

The relevant YoutubeChannelSearchTool.add() implementation is:

def add(
self,
youtube_channel_handle: str,
) -> None:
if not youtube_channel_handle.startswith("@"):
youtube_channel_handle = f"@{youtube_channel_handle}"
super().add(
youtube_channel_handle,
data_type=DataType.YOUTUBE_CHANNEL
)

The loader validates the source against URL patterns such as:

[
"youtube.com/channel/",
"youtube.com/c/",
"youtube.com/@",
"youtube.com/user/",
]

Therefore, @handle does not satisfy the loader's URL validation.

Operating System

Windows 11

Python Version

3.12

crewAI Version

1.15.21

crewAI Tools Version

1.15.21

Virtual Environment

Conda

Evidence

The following error is produced when initializing YoutubeChannelSearchTool with a documented @handle:

ValueError: Invalid YouTube channel URL: @handle

The error originates from:

crewai_tools/rag/loaders/youtube_channel_loader.py

The loader checks for URL patterns including:

"youtube.com/channel/"
"youtube.com/c/"
"youtube.com/@"
"youtube.com/user/"

However, YoutubeChannelSearchTool passes the @handle directly to the RAG adapter instead of converting it into a complete YouTube URL.

Passing a complete URL is also problematic because YoutubeChannelSearchTool.add() prepends "@" to any input that does not already start with "@".

This behavior appears related to issue #5429:
https://github.com/crewAIInc/crewAI/issues/5429

Possible Solution

The tool could resolve a documented @handle into a complete YouTube channel URL before passing it to YoutubeChannelLoader.

For example:

@handle

https://www.youtube.com/@handle

YoutubeChannelLoader

Alternatively, YoutubeChannelLoader could support the @handle format directly.

The important point is that the input format accepted by YoutubeChannelSearchTool should be compatible with the format expected by YoutubeChannelLoader.

Additional context

This issue appears to be related to the previously reported issue #5429:

"YoutubeChannelSearchTool Fails for Valid Channel Inputs"

The behavior is still reproducible with crewai==1.15.21 and crewai-tools==1.15.21.

The current CrewAI documentation indicates that YoutubeChannelSearchTool accepts a YouTube channel handle, so this appears to be a mismatch between the documented API and the current implementation.

No OpenAI API key or LLM configuration is involved in this particular error. The failure occurs during YoutubeChannelSearchTool initialization while loading the YouTube channel.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with YoutubeChannelSearchTool.add() and crewai_tools/rag/loaders/youtube_channel_loader.py, then reproduce the documented @handle failure on Python 3.12 or 3.13. Trace the value into the RAG adapter and loader validation. Done means a documented @handle is accepted and a full channel URL is not incorrectly prefixed with @.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.