tinyhumansai/openhuman · error · anyhow::Error

Task source '{id}' not found

Error message

Task source '{id}' not found

What it means

Thrown by `task_sources::store::get_source` when a SQLite `SELECT ... WHERE id = ?1` on the `task_sources` table returns zero rows. The id simply does not exist in the persisted task-source registry (config workspace DB). Callers reach it directly, or indirectly from `create_source` (which re-reads the row after insert) and `update_source`.

Source

Thrown at src/openhuman/integrations/task_sources/store.rs:123

                i64::from(max_tasks_per_fetch),
                now.to_rfc3339(),
            ],
        )
        .context("Failed to insert task source")?;
        Ok(())
    })?;

    get_source(config, &id)
}

pub fn get_source(config: &Config, id: &str) -> Result<TaskSource> {
    with_connection(config, |conn| {
        let mut stmt = conn.prepare(&format!("{SELECT_SOURCE_COLUMNS} WHERE id = ?1"))?;
        let mut rows = stmt.query(params![id])?;
        if let Some(row) = rows.next()? {
            map_source_row(row).map_err(Into::into)
        } else {
            anyhow::bail!("Task source '{id}' not found")
        }
    })
}

pub fn list_sources(config: &Config) -> Result<Vec<TaskSource>> {
    with_connection(config, |conn| {
        let mut stmt = conn.prepare(&format!(
            "{SELECT_SOURCE_COLUMNS} ORDER BY created_at ASC, id ASC"
        ))?;
        let rows = stmt.query_map([], map_source_row)?;
        let mut out = Vec::new();
        for row in rows {
            out.push(row?);
        }
        Ok(out)
    })
}

View on GitHub (pinned to 7491200858)

Solutions

  1. Verify the id against `list_sources(config)` output before using it.
  2. If the source was recently deleted, refresh your cached ids and stop referencing it.
  3. Confirm you are using the same workspace/user `Config` that the source was created under.
  4. If the source should exist, inspect the `task_sources` table in the workspace sqlite DB to confirm persistence.

Example fix

// before
let src = task_sources::store::get_source(&config, "github-main")?;

// after
let src = match task_sources::store::get_source(&config, "github-main") {
    Ok(s) => s,
    Err(e) if e.to_string().contains("not found") => {
        let available: Vec<_> = task_sources::store::list_sources(&config)?
            .into_iter().map(|s| s.id.clone()).collect();
        anyhow::bail!("source 'github-main' missing; existing ids: {available:?}");
    }
    Err(e) => return Err(e),
};
Defensive patterns

Strategy: validation

Validate before calling

let exists = task_sources::store::list_sources(&config)?
    .iter().any(|s| s.id == id);
anyhow::ensure!(exists, "task source '{id}' does not exist");

Prevention

When it happens

Trigger: Calling `get_source(config, id)` / `update_source` / `record_fetch` / `remove_source`-adjacent reads with an id that was never inserted, was deleted, or whose DB file was reset. Also occurs if the row was inserted into a different workspace/user DB than the one being read (wrong `Config` workspace).

Common situations: Stale id cached in UI state after the source was removed; deleting a source then re-using a saved handle; switching OpenHuman workspaces or users so the sqlite file no longer holds the row; a typo or URL-decoded id mismatch.

Related errors


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/0766b458b937c92b. Report an issue: GitHub.