{"record":{"id":"fdeab4429898755e","repo":"Hmbown/CodeWhale","slug":"tmux-runtime-requires-a-non-empty-command","errorCode":null,"errorMessage":"tmux runtime requires a non-empty command","messagePattern":"tmux runtime requires a non-empty command","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/lane/src/runtime.rs","lineNumber":674,"sourceCode":"}\n\n/// Durable local tmux sessions + attach + stream-json log file.\n#[derive(Debug, Default)]\npub struct TmuxRuntime;\n\nimpl RuntimeBackend for TmuxRuntime {\n    fn kind(&self) -> RuntimeBackendKind {\n        RuntimeBackendKind::Tmux\n    }\n\n    fn start(\n        &self,\n        registry: &LaneRegistry,\n        record: &mut LaneRecord,\n        spec: &LaneStartSpec,\n    ) -> Result<()> {\n        if spec.command.is_empty() {\n            bail!(\"tmux runtime requires a non-empty command\");\n        }\n        // Dry-run is an explicit test hook only. A missing/broken tmux binary\n        // must fail closed rather than persisting a fictional Running Lane.\n        let dry_run = std::env::var_os(\"CODEWHALE_LANE_TMUX_DRY_RUN\").is_some();\n        if !dry_run && let Err(error) = ensure_tmux_available() {\n            append_log_event(\n                &record.log_path,\n                serde_json::json!({\n                    \"type\": \"lane_failed\",\n                    \"lane_id\": record.id,\n                    \"runtime\": \"tmux\",\n                    \"error\": error.to_string(),\n                }),\n            )?;\n            let _ = registry.mark_terminal_if_active(record, LaneStatus::Failed)?;\n            return Err(error);\n        }\n","sourceCodeStart":656,"sourceCodeEnd":692,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/lane/src/runtime.rs#L656-L692","documentation":"The tmux runtime's `start` validates that the lane start spec carries a non-empty command before doing any work. A tmux session must be created with a command to run; an empty command would produce a session that exits immediately or fails in tmux, so the runtime rejects it up front and fails closed before any registry or log mutation.","triggerScenarios":"Calling `LaneRuntime::start` with a `LaneStartSpec` whose `command` field is empty — typically constructed programmatically with a default/empty string, or deserialized from config/CLI where the command argument was omitted or blank.","commonSituations":"A CLI flag like `--command` forgotten or passed as an empty string; a config file with `command = \"\"`; a template that interpolates an unset variable into the command slot.","solutions":["Pass a non-empty command in the `LaneStartSpec` (e.g. `command: vec![\"bash\".into()]`).","Validate the spec at your config-loading/CLI layer before calling `start`, surfacing which flag/field was blank.","If the command comes from a template, check the interpolated result is not empty after substitution."],"exampleFix":"// before\nlet spec = LaneStartSpec { command: vec![], .. };\n\n// after\nlet spec = LaneStartSpec { command: vec![\"bash\".into(), \"-lc\".into(), \"make dev\".into()], .. };","handlingStrategy":"validation","validationCode":"if spec.command.is_empty() {\n    return Err(\"lane command must be non-empty\".into());\n}","typeGuard":"fn has_command(spec: &LaneStartSpec) -> bool { !spec.command.is_empty() }","tryCatchPattern":null,"preventionTips":["Validate LaneStartSpec at the CLI/config boundary before calling start.","Reject empty-string commands in config parsing, not just at runtime."],"tags":["validation","tmux","arguments"],"backgroundTag":"empty-required-field","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"}