langchain - 💡(How to fix) Fix fix(text-splitters): Language.PERL in enum but raises ValueError when used [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#37048Fetched 2026-04-29 06:11:33
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Author
Timeline (top)
labeled ×2closed ×1commented ×1issue_type_added ×1

Language.PERL is listed in the Language enum in base.py (line 406), signaling to users that Perl is a supported language. However, get_separators_for_language() in character.py has no handler for Language.PERL.

Calling RecursiveCharacterTextSplitter.from_language(Language.PERL) raises ValueError: Language perl is not implemented yet! at runtime.

Fix: add a Perl separator list to get_separators_for_language() with keywords such as \nsub , \nmy , \nour , \nif , \nforeach , \nwhile , \nuse , \npackage .

Error Message

from langchain_text_splitters import Language, RecursiveCharacterTextSplitter

PERL is in the Language enum but has no separator implementation

splitter = RecursiveCharacterTextSplitter.from_language(Language.PERL, chunk_size=50, chunk_overlap=0)

Raises: ValueError: Language perl is not implemented yet!

Root Cause

Language.PERL is listed in the Language enum in base.py (line 406), signaling to users that Perl is a supported language. However, get_separators_for_language() in character.py has no handler for Language.PERL.

Calling RecursiveCharacterTextSplitter.from_language(Language.PERL) raises ValueError: Language perl is not implemented yet! at runtime.

Fix: add a Perl separator list to get_separators_for_language() with keywords such as \nsub , \nmy , \nour , \nif , \nforeach , \nwhile , \nuse , \npackage .

Fix Action

Fix / Workaround

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Code Example

from langchain_text_splitters import Language, RecursiveCharacterTextSplitter

# PERL is in the Language enum but has no separator implementation
splitter = RecursiveCharacterTextSplitter.from_language(Language.PERL, chunk_size=50, chunk_overlap=0)
# Raises: ValueError: Language perl is not implemented yet!

---

ValueError: Language perl is not implemented yet!

---

langchain-text-splitters latest — confirmed on current main (base.py line 406, character.py)
RAW_BUFFERClick to expand / collapse

Submission checklist

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Package (Required)

  • langchain-text-splitters

Related Issues / PRs

No response

Reproduction Steps / Example Code (Python)

from langchain_text_splitters import Language, RecursiveCharacterTextSplitter

# PERL is in the Language enum but has no separator implementation
splitter = RecursiveCharacterTextSplitter.from_language(Language.PERL, chunk_size=50, chunk_overlap=0)
# Raises: ValueError: Language perl is not implemented yet!

Error Message and Stack Trace (if applicable)

ValueError: Language perl is not implemented yet!

Description

Language.PERL is listed in the Language enum in base.py (line 406), signaling to users that Perl is a supported language. However, get_separators_for_language() in character.py has no handler for Language.PERL.

Calling RecursiveCharacterTextSplitter.from_language(Language.PERL) raises ValueError: Language perl is not implemented yet! at runtime.

Fix: add a Perl separator list to get_separators_for_language() with keywords such as \nsub , \nmy , \nour , \nif , \nforeach , \nwhile , \nuse , \npackage .

System Info

langchain-text-splitters latest — confirmed on current main (base.py line 406, character.py)

extent analysis

TL;DR

Add a Perl separator list to get_separators_for_language() to support the Perl language.

Guidance

  • Verify that the Language enum in base.py includes PERL and that get_separators_for_language() in character.py does not have a handler for it.
  • Add a separator list for Perl to get_separators_for_language() with keywords such as \nsub , \nmy , \nour , \nif , \nforeach , \nwhile , \nuse , \npackage .
  • Test RecursiveCharacterTextSplitter.from_language(Language.PERL) after implementing the separator list to ensure it no longer raises a ValueError.
  • Consider updating the documentation to reflect the addition of Perl support.

Example

def get_separators_for_language(language):
    # ... existing code ...
    if language == Language.PERL:
        return ["\nsub ", "\nmy ", "\nour ", "\nif ", "\nforeach ", "\nwhile ", "\nuse ", "\npackage "]
    # ... existing code ...

Notes

This fix assumes that the provided separator list is sufficient for the Perl language. Additional testing may be necessary to ensure the correctness of the implementation.

Recommendation

Apply workaround: add the Perl separator list to get_separators_for_language() as described above, because the issue is due to a missing implementation for the Perl language.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

langchain - 💡(How to fix) Fix fix(text-splitters): Language.PERL in enum but raises ValueError when used [1 comments, 2 participants]