{"record":{"id":"5dce42770d263179","repo":"affaan-m/ECC","slug":"context-graph-observation-observation-id-was-no","errorCode":null,"errorMessage":"Context graph observation #{observation_id} was not found","messagePattern":"Context graph observation #(.+?) was not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"ecc2/src/main.rs","lineNumber":2414,"sourceCode":"                    &observation_type,\n                    priority.into(),\n                    pinned,\n                    &summary,\n                    &details,\n                )?;\n                if json {\n                    println!(\"{}\", serde_json::to_string_pretty(&observation)?);\n                } else {\n                    println!(\"{}\", format_graph_observation_human(&observation));\n                }\n            }\n            GraphCommands::PinObservation {\n                observation_id,\n                json,\n            } => {\n                let Some(observation) = db.set_context_observation_pinned(observation_id, true)?\n                else {\n                    return Err(anyhow::anyhow!(\n                        \"Context graph observation #{observation_id} was not found\"\n                    ));\n                };\n                if json {\n                    println!(\"{}\", serde_json::to_string_pretty(&observation)?);\n                } else {\n                    println!(\"{}\", format_graph_observation_human(&observation));\n                }\n            }\n            GraphCommands::UnpinObservation {\n                observation_id,\n                json,\n            } => {\n                let Some(observation) = db.set_context_observation_pinned(observation_id, false)?\n                else {\n                    return Err(anyhow::anyhow!(\n                        \"Context graph observation #{observation_id} was not found\"\n                    ));","sourceCodeStart":2396,"sourceCodeEnd":2432,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/ecc2/src/main.rs#L2396-L2432","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\necc graph pin-observation 9999\n\n// after\necc graph observations --entity-id 42   # find the real id\necc graph pin-observation <real-id>","handlingStrategy":"validation","validationCode":"// Confirm the observation exists before pinning\nfn observation_exists(db: &StateStore, id: i64) -> Result<bool> {\n    Ok(db.get_context_observation(id)?.is_some())\n}\n\nif !observation_exists(&db, observation_id)? {\n    eprintln!(\"observation #{observation_id} not found; run `ecc graph observations`\");\n    return Ok(());\n}","typeGuard":null,"tryCatchPattern":"// Treat pin as best-effort\nmatch db.set_context_observation_pinned(observation_id, true) {\n    Ok(Some(obs)) => print_observation(obs),\n    Ok(None) => eprintln!(\"observation #{observation_id} not found\"),\n    Err(e) => return Err(e),\n}","preventionTips":["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."],"tags":["graph","observation","database","pin"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}