affaan-m/ECC · error
Context graph observation #{observation_id} was not found
Error message
Context graph observation #{observation_id} was not found What it means
Returned by the `graph pin-observation` subcommand when `db.set_context_observation_pinned(observation_id, true)` comes back as `None`, meaning no context-graph observation row matches the supplied ID. The database layer uses `Option<Observation>` to signal "not found" rather than an error, and the CLI converts that `None` into an anyhow bail. The pin operation therefore never runs against a missing row.
Source
Thrown at ecc2/src/main.rs:2414
&observation_type,
priority.into(),
pinned,
&summary,
&details,
)?;
if json {
println!("{}", serde_json::to_string_pretty(&observation)?);
} else {
println!("{}", format_graph_observation_human(&observation));
}
}
GraphCommands::PinObservation {
observation_id,
json,
} => {
let Some(observation) = db.set_context_observation_pinned(observation_id, true)?
else {
return Err(anyhow::anyhow!(
"Context graph observation #{observation_id} was not found"
));
};
if json {
println!("{}", serde_json::to_string_pretty(&observation)?);
} else {
println!("{}", format_graph_observation_human(&observation));
}
}
GraphCommands::UnpinObservation {
observation_id,
json,
} => {
let Some(observation) = db.set_context_observation_pinned(observation_id, false)?
else {
return Err(anyhow::anyhow!(
"Context graph observation #{observation_id} was not found"
));View on GitHub (pinned to 01e15490f0)
Solutions
- List current observations with `ecc graph observations` (optionally `--entity-id`) to confirm the valid ID range.
- Verify you are pointing at the same state store / workspace the observation was created in.
- If the ID is correct but missing, re-sync graph data (`ecc graph sync`) to repopulate observations before pinning.
Example fix
// before ecc graph pin-observation 9999 // after ecc graph observations --entity-id 42 # find the real id ecc graph pin-observation <real-id>
Defensive patterns
Strategy: validation
Validate before calling
// Confirm the observation exists before pinning
fn observation_exists(db: &StateStore, id: i64) -> Result<bool> {
Ok(db.get_context_observation(id)?.is_some())
}
if !observation_exists(&db, observation_id)? {
eprintln!("observation #{observation_id} not found; run `ecc graph observations`");
return Ok(());
} Try / catch
// Treat pin as best-effort
match db.set_context_observation_pinned(observation_id, true) {
Ok(Some(obs)) => print_observation(obs),
Ok(None) => eprintln!("observation #{observation_id} not found"),
Err(e) => return Err(e),
} Prevention
- Always obtain observation IDs from a fresh `graph observations` listing rather than stale notes.
- Confirm the state store path matches the workspace that owns the observation.
- In scripts, check existence before pinning to avoid aborting a batch on one missing row.
When it happens
Trigger: Running `ecc graph pin-observation <id>` with an ID that does not exist in the `context_observations` table. Passing an ID after the underlying observation was deleted, or passing a stale ID copied from an older `graph observations` listing. Supplying a zero or negative ID, or an ID that belongs to a different SQLite database file.
Common situations: Operating against the wrong ECC state database (e.g. a fresh checkout with no graph data yet). Reusing observation IDs across sessions after the store was reset. Typos when transcribing an ID from human-readable output where only a truncated form is shown.
Related errors
- Context graph entity not found: {entity_id}
- Context graph observation type cannot be empty
- Context graph observation summary cannot be empty
- Missing value for --db
- querying user %s: %w
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/5dce42770d263179.
Report an issue: GitHub.