High severity beginner · Fix: 2-5 min

IndexNotFoundError

llama_index.storage.index_store.IndexNotFoundError

What this error means
LlamaIndex throws IndexNotFoundError when attempting to load an index from storage that does not exist or the path is incorrect.

Stack trace

traceback
llama_index.storage.index_store.IndexNotFoundError: Index not found at the specified storage path: './storage/index.json'
QUICK FIX
Verify and correct the storage path passed to load_from_storage and ensure the index was saved there beforehand.

Why it happens

This error occurs because LlamaIndex cannot find the index file at the given storage location. It usually means the index was never saved, the path is wrong, or the storage directory was deleted or moved.

Detection

Check for IndexNotFoundError exceptions when calling load_from_storage and verify the storage path exists and contains the expected index files before loading.

Causes & fixes

1

The index file was never saved to the specified storage path.

✓ Fix

Ensure you call index.save_to_storage(storage_context) after creating the index to persist it before loading.

2

The storage path provided to load_from_storage is incorrect or misspelled.

✓ Fix

Verify the exact path string passed to load_from_storage matches the location where the index was saved, including filename and extension.

3

The storage directory or files were deleted, moved, or corrupted after saving.

✓ Fix

Check the storage directory manually to confirm the index files exist and restore or recreate the index if missing.

Code: broken vs fixed

Broken - triggers the error
python
from llama_index import StorageContext, load_index_from_storage

storage_context = StorageContext.from_defaults(persist_dir='./storage')
index = load_index_from_storage(storage_context)  # Raises IndexNotFoundError if index missing
Fixed - works correctly
python
import os
from llama_index import StorageContext, load_index_from_storage

os.environ['LLAMA_INDEX_PERSIST_DIR'] = './storage'  # Set storage dir via env
storage_context = StorageContext.from_defaults(persist_dir=os.environ['LLAMA_INDEX_PERSIST_DIR'])
index = load_index_from_storage(storage_context)  # Fixed: ensure path exists and index saved
print('Index loaded successfully')
Added environment variable for storage path and ensured the directory exists with saved index files before loading to avoid IndexNotFoundError.

Workaround

Wrap load_index_from_storage in try/except IndexNotFoundError and fallback to creating a new index if loading fails.

Prevention

Always save the index immediately after creation with save_to_storage and verify storage paths programmatically before loading to prevent missing index errors.

Python 3.9+ · llama-index >=0.5.0 · tested on 0.6.x
Verified 2026-04
Verify ↗

Community Notes

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