langchain-ai/langchain · error · RuntimeError
Tracing using LangChainTracerV1 is no longer supported. Plea
Error message
Tracing using LangChainTracerV1 is no longer supported. Please set the LANGCHAIN_TRACING_V2 environment variable to enable tracing instead.
What it means
In `_configure` (manager.py ~2506), if v1 tracing is enabled (`LANGCHAIN_TRACING_V1`/LangChainTracerV1) but v2 is not (`LANGCHAIN_TRACING_V2` unset/false), a `RuntimeError` is raised: LangChainTracerV1 tracing was removed. The library refuses to run with a v1-only configuration rather than silently not tracing.
Source
Thrown at libs/core/langchain_core/callbacks/manager.py:2506
callback_manager.add_metadata(local_metadata or {}, inherit=False)
if tracing_tags:
callback_manager.add_tags(tracing_tags.copy())
v1_tracing_enabled_ = env_var_is_set("LANGCHAIN_TRACING") or env_var_is_set(
"LANGCHAIN_HANDLER"
)
tracer_v2 = tracing_v2_callback_var.get()
tracing_v2_enabled_ = _tracing_v2_is_enabled()
if v1_tracing_enabled_ and not tracing_v2_enabled_:
# if both are enabled, can silently ignore the v1 tracer
msg = (
"Tracing using LangChainTracerV1 is no longer supported. "
"Please set the LANGCHAIN_TRACING_V2 environment variable to enable "
"tracing instead."
)
raise RuntimeError(msg)
tracer_project = _get_tracer_project()
debug = _get_debug()
if verbose or debug or tracing_v2_enabled_:
if verbose and not any(
isinstance(handler, StdOutCallbackHandler)
for handler in callback_manager.handlers
):
if debug:
pass
else:
callback_manager.add_handler(StdOutCallbackHandler(), inherit=False)
if debug and not any(
isinstance(handler, ConsoleCallbackHandler)
for handler in callback_manager.handlers
):
callback_manager.add_handler(ConsoleCallbackHandler())
if tracing_v2_enabled_ and not any(View on GitHub (pinned to e32fa9a52e)
Solutions
- Set `LANGCHAIN_TRACING_V2=true` (and `LANGCHAIN_API_KEY`, optionally `LANGCHAIN_PROJECT`) — the error is suppressed once v2 is on
- Remove `LANGCHAIN_TRACING_V1` and any LangChainTracerV1 references entirely
- Search the repo/deploy configs for the v1 variable: `grep -r LANGCHAIN_TRACING_V1 .`
- After enabling v2, confirm traces appear in the LangSmith project named by LANGCHAIN_PROJECT
Example fix
# before LANGCHAIN_TRACING_V1=true LANGCHAIN_API_KEY=ls__... # after LANGCHAIN_TRACING_V2=true LANGCHAIN_API_KEY=ls__... LANGCHAIN_PROJECT=my-project
Defensive patterns
Strategy: validation
Validate before calling
import os
def tracing_config_ok() -> bool:
v1 = os.environ.get('LANGCHAIN_TRACING_V1')
v2 = os.environ.get('LANGCHAIN_TRACING_V2')
return not (v1 and not _truthy(v2))
def _truthy(v):
return str(v).lower() in {'1', 'true', 'yes'} Prevention
- Delete LANGCHAIN_TRACING_V1 from all env files and deploy manifests
- Standardize on LANGCHAIN_TRACING_V2 + LANGCHAIN_API_KEY (+ LANGCHAIN_PROJECT)
- Add a startup assertion that no v1 variables are set
When it happens
Trigger: Setting `LANGCHAIN_TRACING_V1=true` (or passing a LangChainTracerV1 via env/callbacks) without `LANGCHAIN_TRACING_V2=true`; legacy deployments with old env var sets; .env files carried over from pre-0.1 projects.
Common situations: Upgrading old projects that used LANGCHAIN_TRACING_V1; CI pipelines with stale env matrices; copied docker-compose/k8s manifests still exporting v1 vars. When both are set, v1 is silently ignored, so the error only appears for v1-only configs.
Related errors
- Invalid format: {self._schema_format}
- Received both `client` and `client_kwargs`. Pass `client_kwa
- Could not resolve content_key {full_path!r}: expected a mapp
- Could not resolve content_key {full_path!r}: missing key {ke
- Trying to deserialize something that cannot be deserialized
AI-assisted analysis of langchain-ai/langchain@e32fa9a52e (2026-08-14).
Data as JSON: /api/errors/f5265f0debc2a120.
Report an issue: GitHub.