Tencent/WeKnora · error
remote sandbox: upload script %s: %w
Error message
remote sandbox: upload script %s: %w
What it means
ExecuteOnHandle uploads the script into the remote sandbox at a path under remoteScriptDir using client.WriteFile; if that upload fails the error is wrapped with the remote script path. The script never ran — this is purely an upload/transport failure against the sandbox handle.
Source
Thrown at internal/sandbox/remote_sandbox.go:150
Timeout: effectiveTimeout(cfg, 0),
}
start := time.Now()
execResult, err := s.client.Exec(ctx, handle, request)
return remoteExecuteResult(execResult, err, time.Since(start)), nil
}
content, err := readScriptContent(cfg)
if err != nil {
return nil, err
}
scriptName := filepath.Base(cfg.Script)
if scriptName == "" || scriptName == "." || scriptName == "/" {
return nil, ErrInvalidScript
}
remoteScript := path.Join(remoteScriptDir, scriptName)
if err := s.client.WriteFile(ctx, handle, remoteScript, content); err != nil {
return nil, fmt.Errorf("remote sandbox: upload script %s: %w", remoteScript, err)
}
timeout := effectiveTimeout(cfg, 0)
request := RemoteExecRequest{
Command: getInterpreter(remoteScript),
Args: append([]string{remoteScript}, cfg.Args...),
Stdin: cfg.Stdin,
Env: cfg.Env,
WorkDir: remoteScriptDir,
User: DefaultSandboxExecUser,
Timeout: timeout,
}
start := time.Now()
execResult, err := s.client.Exec(ctx, handle, request)
duration := time.Since(start)
return remoteExecuteResult(execResult, err, duration), nil
}View on GitHub (pinned to 988cbb0330)
Solutions
- Check the wrapped cause for connection vs permission vs size errors and address accordingly
- Re-acquire a fresh handle (or re-create the sandbox) if the old one expired, then retry ExecuteOnHandle
- Reduce script size or split the script if the upload hits payload limits
- Avoid disposing handles concurrently while an ExecuteOnHandle is in flight
Example fix
// before
res, err := sbx.ExecuteOnHandle(ctx, handle, cfg)
// after
res, err := sbx.ExecuteOnHandle(ctx, handle, cfg)
if err != nil && strings.Contains(err.Error(), "upload script") {
if fresh, ferr := s.client.Create(ctx, s.createRequest); ferr == nil {
return sbx.ExecuteOnHandle(ctx, fresh, cfg)
}
} Defensive patterns
Strategy: fallback
Validate before calling
if content, err := os.ReadFile(cfg.Script); err != nil || len(content) > maxUploadSize {
return fmt.Errorf("script unreadable or too large")
} Try / catch
res, err := sbx.ExecuteOnHandle(ctx, handle, cfg)
if err != nil && strings.Contains(err.Error(), "upload script") {
return recreateHandleAndRetry(ctx, cfg)
} Prevention
- Re-create handles rather than reusing long-lived ones
- Keep scripts under provider upload size limits
- Avoid concurrent disposal of a handle in use
When it happens
Trigger: ExecuteOnHandle called with a script whose content WriteFile cannot persist: connection dropped mid-upload, payload too large, permissions on the remote path, or the handle was already disposed/expired.
Common situations: Long sessions where the remote sandbox was reaped mid-run; large skill scripts hitting size limits; flaky network between runner and sandbox; concurrent disposal of the same handle.
Related errors
- remote sandbox provider unavailable: %w
- sandbox: write session input %s: %w
- sandbox: write session file %s: %w
- sandbox: docker client requires a config
- sandbox: docker backend requires an image
AI-assisted analysis of Tencent/WeKnora@988cbb0330 (2026-09-02).
Data as JSON: /api/errors/737041924912e30c.
Report an issue: GitHub.