{"record":{"id":"0766b458b937c92b","repo":"tinyhumansai/openhuman","slug":"task-source-id-not-found","errorCode":null,"errorMessage":"Task source '{id}' not found","messagePattern":"Task source '(.+?)' not found","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/openhuman/integrations/task_sources/store.rs","lineNumber":123,"sourceCode":"                i64::from(max_tasks_per_fetch),\n                now.to_rfc3339(),\n            ],\n        )\n        .context(\"Failed to insert task source\")?;\n        Ok(())\n    })?;\n\n    get_source(config, &id)\n}\n\npub fn get_source(config: &Config, id: &str) -> Result<TaskSource> {\n    with_connection(config, |conn| {\n        let mut stmt = conn.prepare(&format!(\"{SELECT_SOURCE_COLUMNS} WHERE id = ?1\"))?;\n        let mut rows = stmt.query(params![id])?;\n        if let Some(row) = rows.next()? {\n            map_source_row(row).map_err(Into::into)\n        } else {\n            anyhow::bail!(\"Task source '{id}' not found\")\n        }\n    })\n}\n\npub fn list_sources(config: &Config) -> Result<Vec<TaskSource>> {\n    with_connection(config, |conn| {\n        let mut stmt = conn.prepare(&format!(\n            \"{SELECT_SOURCE_COLUMNS} ORDER BY created_at ASC, id ASC\"\n        ))?;\n        let rows = stmt.query_map([], map_source_row)?;\n        let mut out = Vec::new();\n        for row in rows {\n            out.push(row?);\n        }\n        Ok(out)\n    })\n}\n","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/openhuman/integrations/task_sources/store.rs#L105-L141","documentation":"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`.","triggerScenarios":"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).","commonSituations":"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.","solutions":["Verify the id against `list_sources(config)` output before using it.","If the source was recently deleted, refresh your cached ids and stop referencing it.","Confirm you are using the same workspace/user `Config` that the source was created under.","If the source should exist, inspect the `task_sources` table in the workspace sqlite DB to confirm persistence."],"exampleFix":"// before\nlet src = task_sources::store::get_source(&config, \"github-main\")?;\n\n// after\nlet src = match task_sources::store::get_source(&config, \"github-main\") {\n    Ok(s) => s,\n    Err(e) if e.to_string().contains(\"not found\") => {\n        let available: Vec<_> = task_sources::store::list_sources(&config)?\n            .into_iter().map(|s| s.id.clone()).collect();\n        anyhow::bail!(\"source 'github-main' missing; existing ids: {available:?}\");\n    }\n    Err(e) => return Err(e),\n};","handlingStrategy":"validation","validationCode":"let exists = task_sources::store::list_sources(&config)?\n    .iter().any(|s| s.id == id);\nanyhow::ensure!(exists, \"task source '{id}' does not exist\");","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Refresh cached source ids from list_sources after any create/delete.","Scope source ids per workspace/user and never share them across configs.","Treat ids as opaque server-issued tokens rather than constructing them client-side."],"tags":["task-sources","sqlite","not-found","integrations"],"backgroundTag":"record-not-found","analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","schemaVersion":2},"datasetVersion":"2026-08-21T18:17:14.833Z"}