Hmbown/CodeWhale · error

inline lane ` ` cannot be stopped safely from another…

Error message

inline lane `{}` cannot be stopped safely from another process

What it means

Raised by the inline lane runtime's `stop` in crates/lane/src/runtime.rs. Inline lanes run as a plain child of the creating process, so another process cannot safely kill or reap them; the fenced terminal-transition guard (`mark_terminal_if_active_fenced`) invokes a validation closure that rejects the stop when the lane is currently Running and the stop originates from a different process.

Solutions

  1. Stop the lane from the process that started it (send a request to that process instead of calling stop directly).
  2. Kill the owning process first; the lane record's status can then transition safely.
  3. If the lane is orphaned (owner gone), manually mark it Stopped in the registry / clean up the record rather than using the fenced stop.

Example fix

// before: foreign-process stop
registry.stop(id)?; // panics into this error for inline lanes
// after: ask the owner process to stop it
owner_handle.request_stop(id)?;
Defensive patterns

Strategy: validation

Validate before calling

// Only the owner process may stop an inline lane
if !is_owner_process(&record) {
    return Err(anyhow!("delegate stop to owner process of lane {}", record.id));
}

Type guard

fn can_stop_from_here(record: &LaneRecord) -> bool {
    record.runtime != "inline" || is_owner_process(record)
}

Prevention

When it happens

Trigger: Calling `stop` on a Running inline lane from a process other than the one that spawned it (e.g. a second CLI invocation or a watchdog), via `registry.mark_terminal_if_active_fenced(record, LaneStatus::Stopped, fence, ...)` where the fence indicates a foreign process.

Common situations: A management script or TUI restarts and tries to stop a lane left running by a previous session; a tmux test harness stops an inline lane from a sibling process; cleanup tooling sweeping lanes it does not own.

Understand the failure class

Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.

Related errors


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

Appendix: source

Thrown at crates/lane/src/runtime.rs:1064

    }

    fn attach_command(&self, _record: &LaneRecord) -> Option<String> {
        None
    }

    fn stop(
        &self,
        registry: &LaneRegistry,
        record: &mut LaneRecord,
        fence: Option<u64>,
    ) -> Result<TerminalTransition> {
        let transition = registry.mark_terminal_if_active_fenced(
            record,
            LaneStatus::Stopped,
            fence,
            |current| {
                if current.status == LaneStatus::Running {
                    bail!(
                        "inline lane `{}` cannot be stopped safely from another process",
                        current.id
                    );
                }
                Ok(())
            },
        )?;
        if transition.transitioned() {
            self.cleanup_worktree(record)?;
        }
        Ok(transition)
    }
}

/// Placeholder for remote VM / CI backends (surface only in Phase 1).
#[derive(Debug)]
struct StubRuntime {
    kind: RuntimeBackendKind,

View on GitHub (pinned to 73e0f67d83)