Hmbown/CodeWhale · error

DSH is not connected; nothing to

Error message

DSH is not connected; nothing to {}

What it means

set_disabled toggles the `disabled` flag on the current DSH connection record in the receipt document. If the document has no current record (doc.current is None), there is nothing to disable or enable, so this bail fires with the operation name interpolated. It prevents mutating a connection that was never established or already removed.

Solutions

  1. Run `codewhale dsh connect` to establish a connection record first
  2. If you intended a fresh start, run connect rather than enable
  3. Inspect the receipt file to confirm no current record exists
  4. Restore the receipt from backup if it was lost unintentionally

Example fix

// before
codewhale dsh disable   # fails: DSH is not connected; nothing to disable
// after
codewhale dsh connect
codewhale dsh disable
Defensive patterns

Strategy: validation

Validate before calling

let doc = DshReceiptDocument::load(&paths.receipt)?;
if doc.current.is_none() {
    eprintln!("no DSH connection; run connect first");
}

Type guard

fn has_current_connection(doc: &DshReceiptDocument) -> bool {
    doc.current.is_some()
}

Try / catch

match dsh_disable() {
    Err(e) if e.to_string().contains("DSH is not connected") => {
        connect_dsh()?;
        dsh_disable()?;
    }
    r => r,
}

Prevention

When it happens

Trigger: Calling the disable CLI command when DSH was never connected, or calling enable after a terminal `remove` cleared the current record.

Common situations: Fresh machine or wiped DSH_HOME where `connect` was never run; user ran `remove` and later tries `enable`; receipt file manually edited or truncated losing the current record.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@73e0f67d83 (2026-09-22). Data as JSON: /api/errors/6d00588e8f889d42. Report an issue: GitHub.

Appendix: source

Thrown at crates/tui/src/integrations/dsh/mod.rs:539

    doc.save(&paths.receipt)?;
    crate::audit::log_sensitive_event(
        &format!("integration.dsh.{}", event.as_str()),
        serde_json::json!({
            "overlay_path": paths.overlay.display().to_string(),
            "overlay_sha256": plan.overlay_sha256,
            "identity": identity_summary(&plan.mapped),
            "permission_mode": plan.mapped.permission_mode.as_str(),
            "skin": plan.skin,
            "ocean": plan.ocean,
        }),
    );
    Ok(record)
}

pub(crate) fn set_disabled(paths: &DshPaths, disabled: bool) -> Result<DshConnectionRecord> {
    let mut doc = DshReceiptDocument::load(&paths.receipt)?;
    let Some(mut record) = doc.current.take() else {
        anyhow::bail!(
            "DSH is not connected; nothing to {}",
            if disabled { "disable" } else { "enable" }
        );
    };
    record.disabled = disabled;
    record.updated_at = now_rfc3339();
    let event = if disabled {
        DshReceiptEvent::Disable
    } else {
        DshReceiptEvent::Enable
    };
    doc.push(DshReceiptEntry {
        event: event.clone(),
        at: record.updated_at.clone(),
        codewhale_version: codewhale_version(),
        dsh_version: record.dsh_version.clone(),
        dsh_home: record.dsh_home.clone(),
        overlay_sha256: Some(record.overlay_sha256.clone()),

View on GitHub (pinned to 73e0f67d83)