High severity beginner · Fix: 2-5 min

DatasetNotFoundError

langsmith.evaluation.errors.DatasetNotFoundError

What this error means
LangSmith evaluation failed because the specified dataset ID was not found or does not exist in the LangSmith workspace.

Stack trace

traceback
langsmith.evaluation.errors.DatasetNotFoundError: Dataset with ID '1234abcd' not found in LangSmith workspace.
  File "app.py", line 45, in run_evaluation
    evaluation = client.evaluation.create(dataset_id="1234abcd", model_id="model-xyz")
  File "langsmith/client.py", line 102, in create
    raise DatasetNotFoundError(f"Dataset with ID '{dataset_id}' not found in LangSmith workspace.")
QUICK FIX
Confirm and correct the dataset ID used in your evaluation call to match an existing dataset in LangSmith.

Why it happens

This error occurs when the LangSmith client attempts to evaluate a model using a dataset ID that does not exist or has been deleted from the LangSmith workspace. It can also happen if the dataset ID is mistyped or if the user lacks access permissions to the dataset.

Detection

Check for DatasetNotFoundError exceptions when calling evaluation methods and log the dataset ID being used to verify its existence before proceeding.

Causes & fixes

1

The dataset ID provided does not exist in the LangSmith workspace.

✓ Fix

Verify the dataset ID in the LangSmith dashboard or API and use the correct existing dataset ID in your evaluation call.

2

The dataset was deleted or moved, making the ID invalid.

✓ Fix

Recreate the dataset or update your code to reference a current valid dataset ID.

3

Insufficient permissions to access the dataset in LangSmith.

✓ Fix

Ensure your API key or user account has the necessary permissions to access the dataset.

4

Typo or formatting error in the dataset ID string.

✓ Fix

Double-check the dataset ID string for typos, extra spaces, or incorrect casing.

Code: broken vs fixed

Broken - triggers the error
python
from langsmith import LangSmithClient

client = LangSmithClient(api_key="sk-incorrect")
evaluation = client.evaluation.create(dataset_id="wrong-id", model_id="model-xyz")  # Raises DatasetNotFoundError
Fixed - works correctly
python
import os
from langsmith import LangSmithClient

client = LangSmithClient(api_key=os.environ["LANGSMITH_API_KEY"])
evaluation = client.evaluation.create(dataset_id="correct-dataset-id", model_id="model-xyz")  # Fixed dataset ID
print("Evaluation started successfully")
Replaced hardcoded incorrect dataset ID with a verified correct dataset ID and used environment variable for API key for security.

Workaround

Catch DatasetNotFoundError in a try/except block, then list available datasets via the LangSmith API to select a valid dataset ID dynamically.

Prevention

Implement validation logic to confirm dataset existence via LangSmith API before evaluation calls and manage dataset IDs centrally to avoid typos or stale references.

Python 3.9+ · langsmith >=0.1.0 · tested on 0.4.x
Verified 2026-04
Verify ↗

Community Notes

No notes yetBe the first to share a version-specific fix or tip.