wandb.errors.CommError
wandb.errors.CommError: Artifact version not found
Stack trace
wandb.errors.CommError: Artifact version 'v1' not found for artifact 'dataset:latest'
File "/usr/local/lib/python3.9/site-packages/wandb/sdk/internal/internal_api.py", line 1234, in get_artifact
raise CommError(f"Artifact version '{version}' not found for artifact '{name}'") Why it happens
This error occurs when the code requests a specific artifact version that does not exist in the WandB project or the user lacks permission to access it. It can also happen if the artifact name or version string is misspelled or if the artifact has not been logged yet.
Detection
Check for wandb.errors.CommError exceptions when calling wandb.use_artifact or wandb.Api().artifact and verify the artifact name and version exist in the WandB UI before proceeding.
Causes & fixes
Requested artifact version does not exist in the WandB project
Verify the artifact version string is correct and that the artifact has been logged with that version in the WandB project.
Artifact name or version string is misspelled or incorrectly formatted
Double-check the artifact name and version string for typos or incorrect casing and correct them in the code.
User does not have permission to access the specified artifact version
Ensure the WandB API key used has read access to the project and artifact version, or request access from the project owner.
Artifact has not been logged yet or was deleted
Confirm the artifact was successfully logged and not deleted; if missing, log the artifact before attempting to use it.
Code: broken vs fixed
import wandb
run = wandb.init(project="my-project")
artifact = run.use_artifact('dataset:latest') # This line triggers the artifact not found version error
print(artifact) import os
import wandb
os.environ['WANDB_API_KEY'] = os.environ.get('WANDB_API_KEY') # Ensure API key is set
run = wandb.init(project="my-project")
# Specify exact existing artifact version, e.g. 'dataset:v1'
artifact = run.use_artifact('dataset:v1') # Fixed: use correct artifact version
print(artifact) Workaround
Wrap the use_artifact call in try/except wandb.errors.CommError, and if caught, list available artifact versions via wandb.Api() to select a valid version dynamically.
Prevention
Implement validation logic to check artifact existence and versions via wandb.Api() before use, and automate artifact version management to avoid referencing missing versions.