This guide helps you diagnose and resolve common problems when you use the CoreWeave sandbox Python client. Use it to identify the cause of an error and apply a fix. It also explains which conditions trigger each error so you can avoid them later.
Authentication issues
This section covers errors that occur when the SDK can’t find or validate your credentials.
Symptom: CWSandboxAuthenticationError or WandbAuthError raised on sandbox operations.
The SDK resolves authentication in this order:
CWSANDBOX_API_KEY env var (takes priority), a CoreWeave API Access Token
WANDB_API_KEY + WANDB_ENTITY_NAME env vars
~/.netrc (api.wandb.ai) + WANDB_ENTITY_NAME
You need one of these configured. Check which method you’re using:
Common issues
Command execution issues
This section covers problems related to running commands inside a sandbox, including timeouts, long-running processes, and how to interpret exit codes.
Timeout tuning
The difference between client-side and server-side timeouts helps you choose the right setting when a command takes longer than expected. The SDK has two types of timeouts:
Client-side timeout (timeout_seconds):
Server-side lifetime (max_lifetime_seconds):
Long-running commands
Issue: Command takes longer than expected.
Solutions:
- Set an appropriate timeout:
- Use streaming to monitor progress:
Exit code interpretation
Issue: You need to understand command failures.
Exit codes follow Unix conventions:
Use check=True to raise on non-zero exit:
Streaming output issues
This section covers issues that affect how output from a sandbox command appears in your client.
Line buffering behavior
Issue: Output appears delayed or all at once when streaming.
Python buffers stdout when not connected to a TTY. Force unbuffered output:
For your own scripts, flush explicitly:
Cleanup problems
This section covers situations where sandboxes aren’t released as expected. These situations can lead to unnecessary cost and resource consumption.
Orphaned sandboxes
Issue: Sandboxes remain running after script exits or crashes.
Prevention: Use context managers:
See Cleanup patterns: orphan management for how to find and clean up orphaned sandboxes by tag.
Common error messages
The following table summarizes the most common exceptions that the SDK raises, along with their typical causes and recommended fixes.
Last modified on May 29, 2026