Skip to main content
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. Which credential the SDK looks for depends on the authentication strategy you select. The SDK doesn’t fall back from one strategy to the other.
  • CoreWeave (default): reads CWSANDBOX_API_KEY, a CoreWeave API access token, and sends it as a bearer token. Requests go out unauthenticated when the variable isn’t set.
  • W&B: selected explicitly by passing auth=AuthStrategy.WANDB. Credential discovery is delegated to the wandb library, which accepts an active wandb login session, WANDB_API_KEY, or the api.wandb.ai entry in ~/.netrc.
Check which credential you have configured:

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. For command execution, distinguish the operation timeout from the sandbox lifetime: For the complete list of timeout settings and their defaults, see Timeouts. Client-side timeout (timeout_seconds):
Server-side lifetime (max_lifetime_seconds):

Long-running commands

Issue: Command takes longer than expected. Solutions:
  1. Set an appropriate timeout:
  1. 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 September 18, 2026