Hmbown/CodeWhale · error

log file missing: {}

Error message

log file missing: {}

What it means

Thrown by `codewhale lane logs` after the lane is successfully loaded from the LaneRegistry, but `lane.log_path` does not exist on disk. It means the registry entry is intact while the log artifact it points to is gone — the error message includes the full missing path. Reading the file would otherwise fail with a raw OS error, so Codewhale fails fast with an explicit message.

Source

Thrown at crates/cli/src/lib.rs:941

                        println!("{attach}");
                        bail!("tmux attach unavailable");
                    }
                }
            } else {
                println!("{attach}");
                Ok(())
            }
        }
        LaneCommand::Logs {
            lane_id,
            follow,
            tail,
        } => {
            let reg = LaneRegistry::open_default()?;
            let lane = reg.load(&lane_id)?;
            let path = lane.log_path;
            if !path.exists() {
                bail!("log file missing: {}", path.display());
            }
            let content = std::fs::read(&path)?;
            let lines: Vec<&[u8]> = content
                .split(|byte| *byte == b'\n')
                .filter(|line| !line.is_empty())
                .collect();
            let start = lines.len().saturating_sub(tail);
            let mut stdout = std::io::stdout().lock();
            for line in &lines[start..] {
                stdout.write_all(String::from_utf8_lossy(line).as_bytes())?;
                stdout.write_all(b"\n")?;
            }
            stdout.flush()?;
            if !follow {
                return Ok(());
            }
            let mut file = std::fs::File::open(&path)?;
            file.seek(std::io::SeekFrom::End(0))?;

View on GitHub (pinned to 0c42157ee5)

Solutions

  1. Verify the exact path from the error message exists' parent directory and check whether the file was rotated or deleted
  2. Confirm the lane id: run the lane list command and re-run logs with the correct id
  3. If state was wiped, recreate the lane (`codewhale lane start/...`) to regenerate logs
  4. Check that the same user/workspace context owns the state dir (not a different HOME)

Example fix

# before
$ codewhale lane logs stale-lane
# log file missing: /home/user/.local/state/codewhale/lanes/stale-lane/log

# after: re-create the lane so a fresh log exists
$ codewhale lane start --name stale-lane ...
$ codewhale lane logs stale-lane
Defensive patterns

Strategy: validation

Validate before calling

#!/usr/bin/env bash
lane_id="my-lane"
# check registry entry resolves and log exists before asking for logs
codewhale lane list | grep -q "$lane_id" || { echo "unknown lane" >&2; exit 1; }
log="$(codewhale lane list --json 2>/dev/null | jq -r --arg id "$lane_id" '.[] | select(.id==$id) | .log_path')"
[ -f "$log" ] || { echo "log missing, recreate lane" >&2; exit 1; }
codewhale lane logs "$lane_id"

Prevention

When it happens

Trigger: `codewhale lane logs <lane-id>` where the lane's log file was deleted, the workspace/state directory was cleaned (tmpfiles.d, `codewhale` state cleanup, manual rm), the lane was created but its process never started writing, or the state directory moved between machines.

Common situations: System reboot wiped /tmp-based state; user ran a cleanup of ~/.local/state or the codewhale home; lane created on another machine or in another checkout and the registry was copied without log files; disk-full or crash before the first log write.

Understand the failure class

Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.

Related errors


AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20). Data as JSON: /api/errors/8226fcc4e3e25153. Report an issue: GitHub.