SDK

Troubleshooting

Common issues and solutions

Troubleshooting

Common issues and solutions.


Authentication

"Invalid API Key" (401)

Error: Invalid API key

Fix:

  1. Get a new key from optixlog.com
  2. Check for typos/spaces
  3. Pass the key directly:
from optixlog import Optixlog

client = Optixlog(api_key="your_api_key")

Verify your key:

key = "your_api_key"
print(f"Key length: {len(key)}")
print(f"Key preview: {key[:10]}...")

Project Issues

"Project not found"

ValueError: Project 'MyProject' not found. Available projects: [...]

Fix 1: Enable auto-create (recommended):

from optixlog import Optixlog

client = Optixlog(api_key="your_api_key")
project = client.project(name="NewProject", create_if_not_exists=True)

Fix 2: List available projects:

from optixlog import list_projects

projects = list_projects(
    api_url="https://optixlog.com",
    api_key="your_api_key"
)
for p in projects:
    print(p.name)

Fix 3: Create manually:

from optixlog import create_project

create_project(
    api_url="https://optixlog.com",
    api_key="your_api_key",
    name="NewProject"
)

Network Issues

"Cannot connect to server"

Fix:

# Test connection
ping optixlog.com

# Check firewall (port 443)
curl https://optixlog.com/health
import requests

try:
    r = requests.get("https://optixlog.com/health", timeout=5)
    print(f"Status: {r.status_code}")
except Exception as e:
    print(f"Failed: {e}")

Custom API URL

If using a self-hosted instance:

from optixlog import Optixlog

client = Optixlog(
    api_key="your_api_key",
    api_url="http://localhost:3000"  # Your instance
)

MPI Issues

MPI Not Detected

Symptoms: is_master always True, rank always 0

Fix:

# Check env vars
echo $OMPI_COMM_WORLD_RANK  # OpenMPI
echo $PMI_RANK              # Intel MPI

# Install mpi4py
pip install mpi4py

# Verify MPI
mpirun --version

Duplicate Logs

Fix: Check is_master:

from optixlog import Optixlog

client = Optixlog(api_key="your_api_key")
project = client.project(name="ParallelSim")
run = project.run(name="mpi_run")

if client.is_master:
    run.log(step=step, value=value)

Workers Hanging

Cause: Unbalanced barrier calls

Fix: All processes must call barrier:

client.barrier()  # Every process must call this

File Upload Issues

"File not found"

Fix:

import os
from optixlog import Optixlog

client = Optixlog(api_key="your_api_key")
project = client.project(name="FileDemo")
run = project.run(name="upload_test")

path = "results.csv"
if os.path.exists(path):
    run.log_file("results", path, "text/csv")
else:
    print(f"File not found: {path}")

# Or use absolute path
abs_path = os.path.abspath("results.csv")
run.log_file("results", abs_path, "text/csv")

Upload Failed (413)

Cause: File too large

Fix:

  1. Compress large files
  2. Split into chunks
  3. Reduce resolution

Validation Errors

"NaN detected"

MetricResult(step=0, ✗ Invalid metrics: NaN detected in 'loss')

Fix:

import numpy as np
from optixlog import Optixlog

client = Optixlog(api_key="your_api_key")
project = client.project(name="Validation")
run = project.run(name="nan_handling")

value = calculate_value()
if np.isfinite(value):
    run.log(step=0, value=value)
else:
    value = np.nan_to_num(value, nan=0.0)
    run.log(step=0, value=value)

"Step must be non-negative"

Fix:

step = max(0, calculated_step)
run.log(step=step, value=value)

Performance Issues

Slow Logging

Fix 1: Reduce frequency:

from optixlog import Optixlog

client = Optixlog(api_key="your_api_key")
project = client.project(name="Optimized")
run = project.run(name="efficient")

for step in range(10000):
    loss = train_step()
    
    if step % 100 == 0:  # Log every 100 steps
        run.log(step=step, loss=loss)

High Memory

Fix: Close matplotlib figures:

import matplotlib.pyplot as plt
from optixlog import Optixlog

client = Optixlog(api_key="your_api_key")
project = client.project(name="Plots")
run = project.run(name="memory_safe")

fig, ax = plt.subplots()
ax.plot(data)
run.log_matplotlib("plot", fig)
plt.close(fig)  # Important!

Import Errors

ModuleNotFoundError

ModuleNotFoundError: No module named 'optixlog'

Fix:

pip show optixlog  # Verify installed

# Reinstall
pip uninstall optixlog
pip install optixlog

ImportError with new API

If upgrading from an old version:

# Old (deprecated)
import optixlog
with optixlog.run(...) as client:
    pass

# New (current)
from optixlog import Optixlog
client = Optixlog(api_key="your_key")
project = client.project(name="MyProject")
run = project.run(name="experiment")

Common Error Codes

CodeMeaningSolution
401Invalid API keyGet new key from dashboard
403Access deniedCheck key permissions
404Not foundCheck project/run exists
413File too largeCompress/split file
500Server errorRetry or contact support

Debug Checklist

  1. ✅ API key is passed to Optixlog(api_key=...)
  2. ✅ Python 3.8+ installed
  3. ✅ Network connection works
  4. ✅ Project exists or create_if_not_exists=True
  5. ✅ No NaN/Inf values in metrics
  6. ✅ Files exist before upload
  7. ✅ MPI: checking client.is_master before logging

Quick Debug Script

from optixlog import Optixlog

# Test your setup
try:
    client = Optixlog(api_key="your_api_key")
    print(f"✓ Client created")
    print(f"  Is master: {client.is_master}")
    print(f"  Rank: {client.rank}/{client.size}")
    
    project = client.project(name="TestProject", create_if_not_exists=True)
    print(f"✓ Project accessed: {project.name}")
    
    run = project.run(name="debug_test")
    print(f"✓ Run created: {run.run_id}")
    
    result = run.log(step=0, test_value=42)
    print(f"✓ Metric logged: {result}")
    
    print("\n✓ All checks passed!")
    
except Exception as e:
    print(f"✗ Error: {e}")

Getting Help

  1. Check error message for hints

  2. Verify SDK version:

    import optixlog
    print(optixlog.__version__)
  3. Update SDK:

    pip install --upgrade optixlog
  4. Report issues with:

    • Error message
    • SDK version
    • Python version
    • Minimal code example

Next Steps

On this page