High severity beginner · Fix: 2-5 min

AgentOpsProjectNotFoundError

agentops.errors.AgentOpsProjectNotFoundError

What this error means
AgentOps throws this error when the specified project ID or name does not exist or is inaccessible in your AgentOps account.

Stack trace

traceback
Traceback (most recent call last):
  File "main.py", line 42, in <module>
    agent = AgentOpsClient(project_id="my-project")
  File "/usr/local/lib/python3.9/site-packages/agentops/client.py", line 88, in __init__
    raise AgentOpsProjectNotFoundError(f"Project '{project_id}' not found.")
agentops.errors.AgentOpsProjectNotFoundError: Project 'my-project' not found.
QUICK FIX
Double-check and correct the project ID passed to AgentOpsClient and verify your API key permissions.

Why it happens

This error occurs when the AgentOps client attempts to initialize or access a project that does not exist in your AgentOps account or the provided project identifier is incorrect. It can also happen if your API key lacks permissions to view the project or if the project was deleted.

Detection

Check for AgentOpsProjectNotFoundError exceptions during client initialization or API calls, and log the project ID and API key context to verify correctness before retrying.

Causes & fixes

1

Incorrect or misspelled project ID or name passed to the AgentOps client.

✓ Fix

Verify and correct the project ID or name string to exactly match the project identifier in your AgentOps dashboard.

2

API key used does not have permission to access the specified project.

✓ Fix

Ensure the API key has the necessary scopes or roles assigned in AgentOps to access the project.

3

The project was deleted or does not exist in the AgentOps account.

✓ Fix

Confirm the project exists in your AgentOps account and recreate it if necessary.

4

Network or configuration issues causing the client to query the wrong environment or endpoint.

✓ Fix

Check your AgentOps client configuration for correct environment variables and endpoint URLs.

Code: broken vs fixed

Broken - triggers the error
python
from agentops import AgentOpsClient

client = AgentOpsClient(project_id="my-project")  # This line raises AgentOpsProjectNotFoundError
client.run_agent()
Fixed - works correctly
python
import os
from agentops import AgentOpsClient

os.environ["AGENTOPS_API_KEY"] = os.environ.get("AGENTOPS_API_KEY", "your_api_key_here")

client = AgentOpsClient(project_id="correct-project-id")  # Fixed project ID and set API key via env
client.run_agent()
print("Agent ran successfully.")
Corrected the project ID to match an existing project and set the API key via environment variable to ensure proper authentication.

Workaround

Catch AgentOpsProjectNotFoundError and prompt the user to verify the project ID or fallback to a default project if available.

Prevention

Implement validation of project IDs before client initialization and use environment-based configuration management to avoid hardcoding project identifiers.

Python 3.9+ · agentops >=1.0.0 · tested on 1.2.3
Verified 2026-04
Verify ↗

Community Notes

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