Hmbown/CodeWhale · error

dsh exited with status {code}

Error message

dsh exited with status {code}

What it means

After `dsh::launch_spec` builds and prints the launch command, `dsh::spawn_launch` runs `dsh --profile <p> [--patch <overlay>]` with `DSH_PERMISSION_MODE` exported and provider key env vars stripped (dsh/mod.rs:694-707). This error means the dsh child process started but exited non-zero — the failure is inside dsh, not in the Codewhale integration layer. A child killed by a signal is reported as code 1 via `status.code().unwrap_or(1)`.

Source

Thrown at crates/tui/src/integrations/cli.rs:362

                record.overlay_path.display(),
                record.overlay_sha256
            );
            Ok(())
        }
        DshIntegrationCommand::Launch {
            profile,
            dry_run,
            args,
        } => {
            let (_paths, report) = status_report(config, workspace, false)?;
            let spec = dsh::launch_spec(&report, profile.as_deref(), &args, workspace)?;
            println!("{RELATIONSHIP_LABEL}: {}", spec.display());
            if dry_run {
                return Ok(());
            }
            let code = dsh::spawn_launch(&spec)?;
            if code != 0 {
                anyhow::bail!("dsh exited with status {code}");
            }
            Ok(())
        }
        DshIntegrationCommand::Disable => {
            let paths = DshPaths::from_process()?;
            let record = dsh::set_disabled(&paths, true)?;
            println!(
                "disabled: overlay kept at {}; launches refused",
                record.overlay_path.display()
            );
            Ok(())
        }
        DshIntegrationCommand::Enable => {
            let paths = DshPaths::from_process()?;
            let record = dsh::set_disabled(&paths, false)?;
            println!("enabled: {}", record.overlay_path.display());
            Ok(())
        }

View on GitHub (pinned to 8880682c63)

Solutions

  1. Re-run the printed launch spec manually (it is printed before spawn, e.g. `dsh --profile web --patch <overlay>`) to see dsh's own error output
  2. Provide dsh credentials: `DEEPSEEK_API_KEY` in dsh's environment or `$DSH_HOME/.credentials.yaml` — Codewhale deliberately hands over no key
  3. Treat code 1 with no dsh diagnostics as a possible signal kill: check dmesg/OOM and whether the terminal was resized or closed
  4. Verify the pinned identity is still valid provider-side via `codewhale integrations dsh status`, then `update` if the model or base_url drifted

Example fix

// before
let code = dsh::spawn_launch(&spec)?;
if code != 0 {
    anyhow::bail!("dsh exited with status {code}");
}

// after — keep the spec visible so the user can reproduce dsh's own failure
let code = dsh::spawn_launch(&spec)?;
if code != 0 {
    eprintln!("to reproduce: {}", spec.display());
    anyhow::bail!("dsh exited with status {code}; rerun the command above to see dsh's own output");
}
Defensive patterns

Strategy: try-catch

Try / catch

match dsh::spawn_launch(&spec) {
    Ok(0) => Ok(()),
    Ok(code) => {
        // child ran and failed: keep spec.display() visible so the user can
        // rerun dsh manually and see its own diagnostics
        eprintln!("to reproduce: {}", spec.display());
        Err(anyhow::anyhow!("dsh exited with status {code}"))
    }
    Err(e) => Err(e), // spawn-level failure: binary missing, permissions
}

Prevention

When it happens

Trigger: `codewhale integrations dsh launch` without `--dry-run` when dsh exits non-zero: no DEEPSEEK_API_KEY and no `$DSH_HOME/.credentials.yaml`, an invalid profile name, the overlay pinning a model/base_url that rejects requests, or dsh crashing. Exit code 1 can also mean the process was terminated by a signal.

Common situations: First launch on a machine where dsh has never been authenticated; the pinned model was renamed provider-side so every request fails; `DSH_PERMISSION_MODE=read-only` blocking a write the session attempted; proxies or offline environments blocking the endpoint; OOM or terminal teardown killing the child.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/5517751d7a09f46f. Report an issue: GitHub.