{"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":"validation","errorClass":"anyhow::Error","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/8321021c54d670126ce3b2969d5deb880b4b0c2a/ecc2/src/main.rs#L2396-L2432","documentation":"The `graph pin-observation` command toggles the pinned flag on a context graph observation by ID via `db.set_context_observation_pinned`. The DB layer returns `Ok(None)` when no observation with that ID exists, and the command converts that into this error instead of failing silently.","triggerScenarios":"Running `ecc2 graph pin-observation <observation_id>` where the numeric ID does not match any row in the context observations table (including already-deleted observations).","commonSituations":"Using an ID copied from another database/project; the observation was pruned or deleted; typo in the numeric ID; assuming IDs are globally sequential across machines.","solutions":["List context observations (`ecc2 graph ...` list output) and use a valid observation ID.","Check the numeric ID for typos or off-by-one mistakes.","If the observation was deleted, re-record it or pin a different one.","Confirm you are operating on the same project database the observation was created in."],"exampleFix":"// before (shell)\necc2 graph pin-observation 87   # -> \"Context graph observation #87 was not found\"\n\n// after\necc2 graph list-observations    # find a valid ID\necc2 graph pin-observation 42","handlingStrategy":"validation","validationCode":"// shell: confirm the observation ID exists before pinning\necc2 graph list-observations --json | jq -e --argjson id \"$OBS_ID\" 'map(.id) | index($id)' >/dev/null || { echo \"observation #$OBS_ID not found\"; exit 1; }","typeGuard":"fn observation_exists(db: &Db, id: i64) -> anyhow::Result<bool> {\n    Ok(db.set_context_observation_pinned(id, false)?.is_some()) // read-style probe variant if available\n}","tryCatchPattern":"// handle the None case as a lookup miss\nmatch db.set_context_observation_pinned(observation_id, true)? {\n    Some(obs) => print(obs),\n    None => eprintln!(\"observation #{observation_id} not found; list observations to get valid IDs\"),\n}","preventionTips":["Copy observation IDs from fresh list output rather than memory.","Note that IDs are per-database; do not reuse them across projects or machines.","Check that the observation wasn't pruned by retention/cleanup jobs.","Script pin operations to look up the ID immediately before pinning."],"tags":["cli","database","context-graph","rust"],"backgroundTag":"entity-not-found","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}