{"record":{"id":"b37df891d171ad69","repo":"Hmbown/CodeWhale","slug":"dsh-is-already-connected-use-cli-command-updat","errorCode":null,"errorMessage":"DSH is already connected; use `{CLI_COMMAND} update` to rewrite the overlay","messagePattern":"DSH is already connected; use `(.+?) update` to rewrite the overlay","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/integrations/cli.rs","lineNumber":302,"sourceCode":"                print_plan(&plan, \"connect\");\n                if !report.detection.installed() {\n                    println!(\n                        \"  warning: dsh is not on PATH; the plan is valid but launch will fail\"\n                    );\n                }\n            }\n            Ok(())\n        }\n        DshIntegrationCommand::Connect {\n            profile,\n            allow_full_access,\n            skin,\n            yes,\n        } => {\n            let (paths, report) = status_report(config, workspace, allow_full_access)?;\n            ensure_launchable_dsh(&report)?;\n            if report.record.as_ref().is_some_and(|r| !r.disabled) {\n                anyhow::bail!(\n                    \"DSH is already connected; use `{CLI_COMMAND} update` to rewrite the overlay\"\n                );\n            }\n            let identity = dsh::codewhale_route_identity(config, workspace)\n                .map_err(|e| anyhow::anyhow!(\"cannot resolve the current Codewhale route: {e}\"))?;\n            let plan = dsh::plan(\n                &paths,\n                &report.detection,\n                &identity,\n                &profile,\n                allow_full_access,\n                skin,\n                true,\n            )?;\n            print_plan(&plan, \"connect\");\n            confirm(yes, \"Write these Codewhale-owned files and connect DSH?\")?;\n            let record =\n                dsh::apply_plan(&paths, &report.detection, &plan, DshReceiptEvent::Connect)?;","sourceCodeStart":284,"sourceCodeEnd":320,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/integrations/cli.rs#L284-L320","documentation":"Thrown by `run_dsh` during a DSH connect attempt when a status report shows an existing, non-disabled DSH integration record. Connecting would overwrite the existing overlay, so the library requires the explicit `update` subcommand instead.","triggerScenarios":"Running `dsh connect` when `report.record` exists with `disabled == false` — i.e. the harness is already connected and the overlay is active.","commonSituations":"Re-running connect after a successful setup; running connect in a fresh checkout/machine state check where the overlay file still exists; scripted re-provisioning that assumed connect is idempotent.","solutions":["Use `dsh update` to rewrite the existing overlay instead of connect","Run `dsh disable` first if you genuinely want to re-connect from scratch","Inspect `dsh status` to confirm the existing record before choosing update"],"exampleFix":"// before\n$ codewhale dsh connect\nerror: DSH is already connected...\n// after\n$ codewhale dsh update","handlingStrategy":"validation","validationCode":"// check state before connect\nlet report = status_report(&config, &workspace, false)?;\nlet already_connected = report.record.as_ref().is_some_and(|r| !r.disabled);\nif already_connected { /* run update instead of connect */ }","typeGuard":null,"tryCatchPattern":"match result {\n    Err(e) if e.to_string().contains(\"already connected\") => /* switch to `dsh update` */,\n    other => return other,\n}","preventionTips":["Check `dsh status` before running connect","Use update for re-provisioning on an active integration","Make scripts idempotent: update if connected, connect otherwise"],"tags":["cli","state","duplicate-operation","integration"],"backgroundTag":"invalid-state-transition","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"}