langchain-ai/langchain · error · RuntimeError

Loading from the deprecated github-based Hub is no longer su

Error message

Loading from the deprecated github-based Hub is no longer supported. Please use the new LangChain Hub at https://smith.langchain.com/hub instead.

What it means

`load_prompt` raises a `RuntimeError` (not `ValueError`) when given a path starting with `lc://` — the scheme of the old GitHub-based LangChain Hub. That hub is dead, so the scheme is unconditionally rejected with a pointer to the successor, the LangChain Hub at https://smith.langchain.com/hub.

Source

Thrown at libs/core/langchain_core/prompts/loading.py:246

        allow_dangerous_paths: If `False` (default), file paths referenced
            inside the loaded config (such as `template_path`, `examples`,
            and `example_prompt_path`) are validated to reject absolute paths
            and directory traversal (`..`) sequences. Set to `True` only
            if you trust the source of the config.

    Returns:
        A `PromptTemplate` object.

    Raises:
        RuntimeError: If the path is a LangChainHub path.
    """
    if isinstance(path, str) and path.startswith("lc://"):
        msg = (
            "Loading from the deprecated github-based Hub is no longer supported. "
            "Please use the new LangChain Hub at https://smith.langchain.com/hub "
            "instead."
        )
        raise RuntimeError(msg)
    return _load_prompt_from_file(
        path, encoding, allow_dangerous_paths=allow_dangerous_paths
    )


def _load_prompt_from_file(
    file: str | Path,
    encoding: str | None = None,
    *,
    allow_dangerous_paths: bool = False,
) -> BasePromptTemplate[str]:
    """Load prompt from file."""
    # Convert file to a Path object.
    file_path = Path(file)
    # Load from either json or yaml.
    if file_path.suffix == ".json":
        with file_path.open(encoding=encoding) as f:
            config = json.load(f)

View on GitHub (pinned to e32fa9a52e)

Solutions

  1. Pull the prompt from the LangSmith Hub instead: `from langchain import hub; prompt = hub.pull('owner/prompt-name')` (requires `langchain` package + `LANGSMITH_API_KEY`).
  2. Vendor the prompt: download its text once, save it locally as f-string JSON/YAML, and `load_prompt('file.json')`.
  3. Replace the `lc://` handle with an inline template built via `PromptTemplate.from_template`.

Example fix

# before
from langchain_core.prompts import load_prompt
prompt = load_prompt('lc://hello/name')  # RuntimeError

# after
from langchain import hub
prompt = hub.pull('hello-name')
Defensive patterns

Strategy: try-catch

Validate before calling

if isinstance(path, str) and path.startswith('lc://'):
    raise ValueError('lc:// hub handles are dead; use langchain hub.pull instead')

Type guard

def is_hub_handle(path: str) -> bool:
    return path.startswith('lc://')

Try / catch

from langchain_core.prompts import load_prompt
try:
    prompt = load_prompt(path)
except RuntimeError as e:
    if 'github-based Hub' in str(e):
        from langchain import hub
        prompt = hub.pull(path.removeprefix('lc://'))  # best-effort migration
    else:
        raise

Prevention

When it happens

Trigger: Calling `load_prompt('lc://prompts/some/prompt')` or loading a config that embeds an `lc://` reference.

Common situations: Old tutorials and notebooks from the 2023-era LangChain; legacy codebases that pinned prompts by `lc://` handle; copied snippets from outdated blog posts.

Related errors


AI-assisted analysis of langchain-ai/langchain@e32fa9a52e (2026-08-14). Data as JSON: /api/errors/8854ab4254547480. Report an issue: GitHub.