Hmbown/CodeWhale · error · anyhow::Error

receipt path has no parent

Error message

receipt path has no parent

What it means

Error "receipt path has no parent" thrown in Hmbown/CodeWhale.

Source

Thrown at crates/tui/src/integrations/dsh/receipt.rs:133

            Err(error) if error.kind() == std::io::ErrorKind::NotFound => Ok(Self::default()),
            Err(error) => {
                Err(error).with_context(|| format!("read DSH receipt {}", path.display()))
            }
        }
    }

    pub(crate) fn push(&mut self, entry: DshReceiptEntry) {
        self.history.push(entry);
        if self.history.len() > MAX_HISTORY {
            let excess = self.history.len() - MAX_HISTORY;
            self.history.drain(0..excess);
        }
    }

    pub(crate) fn save(&self, path: &Path) -> Result<()> {
        let parent = path
            .parent()
            .ok_or_else(|| anyhow::anyhow!("receipt path has no parent"))?;
        std::fs::create_dir_all(parent).with_context(|| format!("create {}", parent.display()))?;
        let json = serde_json::to_vec_pretty(self)?;
        write_atomic(path, &json)
    }
}

/// Write via a sibling temp file + rename so a crash never leaves a torn
/// receipt or overlay behind.
pub(crate) fn write_atomic(path: &Path, bytes: &[u8]) -> Result<()> {
    let parent = path
        .parent()
        .ok_or_else(|| anyhow::anyhow!("path has no parent"))?;
    let tmp = parent.join(format!(
        ".{}.tmp-{}",
        path.file_name()
            .map(|n| n.to_string_lossy().into_owned())
            .unwrap_or_else(|| "file".to_string()),
        std::process::id()

View on GitHub (pinned to 8880682c63)

When it happens

Trigger: Thrown at crates/tui/src/integrations/dsh/receipt.rs:133 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Hmbown/CodeWhale@8880682c63 (2026-08-16). Data as JSON: /api/errors/98abffa1fbbeb841. Report an issue: GitHub.