JuliusBrussee/caveman · error

ccr task decision find: %w

Error message

ccr task decision find: %w

What it means

Wraps the SELECT failure in Store.FindTaskDecision when looking up a Decision Ledger object by decision id via json_extract. Distinguishable from not-found (ErrNotFound); fires when the query itself errors, e.g. locked or corrupt database.

Source

Thrown at engine/ccr/store_sqlite.go:659

		return nil, fmt.Errorf("ccr typed object list rows: %w", err)
	}
	return objects, nil
}

// FindTaskDecision returns one Decision Ledger object by its stable decision
// ID. Callers still validate the versioned decision schema before rendering it.
func (s *Store) FindTaskDecision(decisionID string) (Object, error) {
	obj, err := scanObject(s.db.QueryRow(
		`SELECT `+objectColumns+` FROM typed_objects
		 WHERE object_type = ? AND json_extract(CAST(data AS TEXT), '$.decision_id') = ?
		 ORDER BY created_at DESC, object_id DESC LIMIT 1`,
		ObjectTaskDecision, decisionID,
	))
	if errors.Is(err, sql.ErrNoRows) {
		return Object{}, ErrNotFound
	}
	if err != nil {
		return Object{}, fmt.Errorf("ccr task decision find: %w", err)
	}
	return obj, nil
}

// Summary aggregates stored recoveries into totals + per-content-type buckets.
func (s *Store) Summary() (Stats, error) {
	out := Stats{ByContentType: map[string]Bucket{}, Basis: "inferred"}
	rows, err := s.db.Query(
		`SELECT content_type, COUNT(*), COALESCE(SUM(tokens_before),0), COALESCE(SUM(tokens_after),0)
		 FROM recoveries GROUP BY content_type`)
	if err != nil {
		return out, fmt.Errorf("ccr summary: %w", err)
	}
	defer rows.Close()
	for rows.Next() {
		var ct string
		var b Bucket
		if err := rows.Scan(&ct, &b.Count, &b.TokensBefore, &b.TokensAfter); err != nil {

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Check the wrapped driver error
  2. Retry the lookup after contention clears
  3. Verify the typed_objects table and its JSON1 functions are available
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at engine/ccr/store_sqlite.go:659 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18). Data as JSON: /api/errors/5d8fd4fc48de684a. Report an issue: GitHub.