aaif-goose/goose · warning

Download not found

Error message

Download not found

What it means

cancel_download flips a record's status to Cancelled only when an entry exists for model_id. Unknown ids, entries removed after completion (clear_completed), or races where the entry was already removed fail with 'Download not found'.

Source

Thrown at crates/goose-download-manager/src/lib.rs:162

    pub fn update_progress(&self, model_id: &str, update: impl FnOnce(&mut DownloadProgress)) {
        if let Ok(mut downloads) = self.downloads.lock() {
            if let Some(progress) = downloads.get_mut(model_id) {
                update(progress);
            }
        }
    }

    pub fn cancel_download(&self, model_id: &str) -> Result<()> {
        let mut downloads = self
            .downloads
            .lock()
            .map_err(|_| anyhow::anyhow!("Failed to acquire lock"))?;

        if let Some(progress) = downloads.get_mut(model_id) {
            progress.status = DownloadStatus::Cancelled;
            Ok(())
        } else {
            anyhow::bail!("Download not found")
        }
    }

    pub async fn download_model(
        &self,
        model_id: String,
        url: String,
        destination: PathBuf,
        on_complete: Option<Box<dyn FnOnce() + Send + 'static>>,
    ) -> Result<()> {
        self.download_model_sharded(model_id, vec![(url, destination)], 0, on_complete)
            .await
    }

    pub async fn download_model_with_bearer_token(
        &self,
        model_id: String,
        url: String,

View on GitHub (pinned to 3810898a74)

Solutions

  1. Check current state first with get_progress(model_id) or is_downloading(model_id)
  2. Treat 'not found' as already-finished and make it a no-op at the call site
  3. Ensure the exact same model_id string is used to start and cancel

Example fix

// before
manager.cancel_download(&model_id)?;
// after
if manager.get_progress(&model_id).is_some() {
    manager.cancel_download(&model_id)?;
}
Defensive patterns

Strategy: validation

Validate before calling

if manager.get_progress(&model_id).is_some() {
    manager.cancel_download(&model_id)?;
} else {
    // nothing to cancel: already finished or never started
}

Try / catch

if let Err(e) = manager.cancel_download(&model_id) {
    if e.to_string() == "Download not found" {
        return Ok(()); // treat as already finished
    }
    return Err(e);
}

Prevention

When it happens

Trigger: Calling cancel_download after the download finished and its entry was cleared, with a mistyped model_id, or racing another path that removed the entry.

Common situations: UIs issuing cancel after a completion event arrives out of order; model_id strings that differ between start and cancel call sites.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/b6e98cc18d6577c6. Report an issue: GitHub.