affaan-m/ECC · warning · anyhow::Error
Context graph observation summary cannot be empty
Error message
Context graph observation summary cannot be empty
What it means
Raised by add_context_observation in ecc2/src/session/store.rs:3385 when summary.trim().is_empty(). The summary is the human-readable body of an observation; an empty summary would produce useless entries, so it is rejected after the type check and before the INSERT.
Source
Thrown at ecc2/src/session/store.rs:3385
}
pub fn add_context_observation(
&self,
session_id: Option<&str>,
entity_id: i64,
observation_type: &str,
priority: ContextObservationPriority,
pinned: bool,
summary: &str,
details: &BTreeMap<String, String>,
) -> Result<ContextGraphObservation> {
if observation_type.trim().is_empty() {
return Err(anyhow::anyhow!(
"Context graph observation type cannot be empty"
));
}
if summary.trim().is_empty() {
return Err(anyhow::anyhow!(
"Context graph observation summary cannot be empty"
));
}
let now = chrono::Utc::now().to_rfc3339();
let details_json = serde_json::to_string(details)?;
self.conn.execute(
"INSERT INTO context_graph_observations (
session_id, entity_id, observation_type, priority, pinned, summary, details_json, created_at
) VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8)",
rusqlite::params![
session_id,
entity_id,
observation_type.trim(),
priority.as_db_value(),
pinned as i64,
summary.trim(),
details_json,View on GitHub (pinned to 01e15490f0)
Solutions
- Validate summary is non-empty after trim at the call site; require at least one meaningful character.
- If auto-generating, fall back to a default like "(no summary)" or skip the observation.
- During import, quarantine rows with empty summaries.
Example fix
// before
store.add_context_observation(Some(sid), entity_id, otype, priority, pinned, "", &details)?;
// after: require a meaningful summary
let summary = summary.trim();
if summary.is_empty() {
anyhow::bail!("observation summary is required for entity {entity_id}");
}
store.add_context_observation(Some(sid), entity_id, otype, priority, pinned, summary, &details)?; Defensive patterns
Strategy: validation
Validate before calling
// Validating newtype for observation summary.
#[derive(Debug, Clone)]
pub struct ObservationSummary(String);
impl ObservationSummary {
pub fn new(raw: &str) -> anyhow::Result<Self> {
let trimmed = raw.trim();
if trimmed.is_empty() {
anyhow::bail!("observation summary cannot be empty");
}
Ok(Self(trimmed.to_string()))
}
pub fn as_str(&self) -> &str { &self.0 }
}
let summary = ObservationSummary::new(raw)?;
store.add_context_observation(sid, entity_id, otype, priority, pinned, summary.as_str(), &details)?; Type guard
// ObservationSummary (above) is the type guard; it cannot represent an // empty string.
Try / catch
for record in observation_import {
let summary = match ObservationSummary::new(&record.summary) {
Ok(s) => s,
Err(_) => { tracing::warn!("skipping observation with empty summary on entity {}", record.entity_id); continue; }
};
store.add_context_observation(sid, record.entity_id, otype, record.priority, record.pinned, summary.as_str(), &record.details)?;
} Prevention
- Wrap observation summary in a validating newtype.
- For auto-generated summaries, fall back to a default like '(no summary)' or skip the observation.
- Skip blank-summary records during import.
- Require a meaningful summary at the UI layer.
When it happens
Trigger: Passing summary = "" or whitespace; a caller that builds summary from optional detail fields that are all empty; importing observations with blank summaries.
Common situations: Auto-generated observations where the summarizer produced nothing; UI submissions where the summary field is left blank; bulk import with sparse data.
Related errors
- Context graph observation type cannot be empty
- Context graph entity type cannot be empty
- Context graph entity name cannot be empty
- Context graph relation type cannot be empty
- Context graph observation #{observation_id} was not found
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/e32055064efe9bc8.
Report an issue: GitHub.