{"record":{"id":"6d00588e8f889d42","repo":"Hmbown/CodeWhale","slug":"dsh-is-not-connected-nothing-to","errorCode":null,"errorMessage":"DSH is not connected; nothing to {}","messagePattern":"DSH is not connected; nothing to (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/integrations/dsh/mod.rs","lineNumber":539,"sourceCode":"    doc.save(&paths.receipt)?;\n    crate::audit::log_sensitive_event(\n        &format!(\"integration.dsh.{}\", event.as_str()),\n        serde_json::json!({\n            \"overlay_path\": paths.overlay.display().to_string(),\n            \"overlay_sha256\": plan.overlay_sha256,\n            \"identity\": identity_summary(&plan.mapped),\n            \"permission_mode\": plan.mapped.permission_mode.as_str(),\n            \"skin\": plan.skin,\n            \"ocean\": plan.ocean,\n        }),\n    );\n    Ok(record)\n}\n\npub(crate) fn set_disabled(paths: &DshPaths, disabled: bool) -> Result<DshConnectionRecord> {\n    let mut doc = DshReceiptDocument::load(&paths.receipt)?;\n    let Some(mut record) = doc.current.take() else {\n        anyhow::bail!(\n            \"DSH is not connected; nothing to {}\",\n            if disabled { \"disable\" } else { \"enable\" }\n        );\n    };\n    record.disabled = disabled;\n    record.updated_at = now_rfc3339();\n    let event = if disabled {\n        DshReceiptEvent::Disable\n    } else {\n        DshReceiptEvent::Enable\n    };\n    doc.push(DshReceiptEntry {\n        event: event.clone(),\n        at: record.updated_at.clone(),\n        codewhale_version: codewhale_version(),\n        dsh_version: record.dsh_version.clone(),\n        dsh_home: record.dsh_home.clone(),\n        overlay_sha256: Some(record.overlay_sha256.clone()),","sourceCodeStart":521,"sourceCodeEnd":557,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/integrations/dsh/mod.rs#L521-L557","documentation":"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.","triggerScenarios":"Calling the disable CLI command when DSH was never connected, or calling enable after a terminal `remove` cleared the current record.","commonSituations":"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.","solutions":["Run `codewhale dsh connect` to establish a connection record first","If you intended a fresh start, run connect rather than enable","Inspect the receipt file to confirm no current record exists","Restore the receipt from backup if it was lost unintentionally"],"exampleFix":"// before\ncodewhale dsh disable   # fails: DSH is not connected; nothing to disable\n// after\ncodewhale dsh connect\ncodewhale dsh disable","handlingStrategy":"validation","validationCode":"let doc = DshReceiptDocument::load(&paths.receipt)?;\nif doc.current.is_none() {\n    eprintln!(\"no DSH connection; run connect first\");\n}","typeGuard":"fn has_current_connection(doc: &DshReceiptDocument) -> bool {\n    doc.current.is_some()\n}","tryCatchPattern":"match dsh_disable() {\n    Err(e) if e.to_string().contains(\"DSH is not connected\") => {\n        connect_dsh()?;\n        dsh_disable()?;\n    }\n    r => r,\n}","preventionTips":["Always connect before attempting disable/enable","After a remove, treat the integration as fresh and reconnect","Avoid hand-editing the receipt file"],"tags":["state","dsh-lifecycle","missing-record"],"backgroundTag":"record-not-found","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}