tinyhumansai/openhuman · error

failed to collect mcp_writes rows

Error message

failed to collect mcp_writes rows

What it means

query_map succeeded but iterating the resulting row iterator (mapped rows / row_to_record conversion) failed while collecting mcp_writes rows. This is the 'failed to collect mcp_writes rows' context: an individual row could not be converted to the audit record type — usually a schema/value mismatch (unexpected NULL in a non-optional column, or an integer where a string is expected) rather than a query failure.

Source

Thrown at src/openhuman/mcp/audit/store.rs:184

            Err(err) => {
                log::warn!("[mcp_audit] list_writes prepare failed error={err}");
                return Err(anyhow::Error::new(err))
                    .context("failed to prepare mcp_writes list query");
            }
        };
        log::trace!("[mcp_audit] list_writes executing query");
        let mapped = match stmt.query_map(refs.as_slice(), row_to_record) {
            Ok(mapped) => mapped,
            Err(err) => {
                log::warn!("[mcp_audit] list_writes query failed error={err}");
                return Err(anyhow::Error::new(err)).context("failed to query mcp_writes");
            }
        };
        let rows = match mapped.collect::<rusqlite::Result<Vec<_>>>() {
            Ok(rows) => rows,
            Err(err) => {
                log::warn!("[mcp_audit] list_writes collect failed error={err}");
                return Err(anyhow::Error::new(err)).context("failed to collect mcp_writes rows");
            }
        };
        log::debug!("[mcp_audit] list_writes exit rows={}", rows.len());
        Ok(rows)
    });
    if let Err(err) = &result {
        log::warn!("[mcp_audit] list_writes failed error={err}");
    }
    result
}

fn normalized_limit(limit: Option<u64>) -> Result<i64> {
    u64_to_i64(
        limit.unwrap_or(DEFAULT_LIST_LIMIT).min(MAX_LIST_LIMIT),
        "limit",
    )
}

View on GitHub (pinned to 7491200858)

Solutions

  1. Inspect the failing row's columns for NULLs or type mismatches against the record struct's FromSql expectations
  2. Make row_to_record tolerant (default/Option handling) for legacy rows written by an older schema
  3. If the table contains malformed legacy rows, migrate or vacuum the audit database
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at src/openhuman/mcp/audit/store.rs:184 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of tinyhumansai/openhuman@7491200858 (2026-08-17). Data as JSON: /api/errors/cd13a0fddd1171b9. Report an issue: GitHub.