JuliusBrussee/caveman · error

ccr typed object put rows: %w

Error message

ccr typed object put rows: %w

What it means

Wraps the RowsAffected call after the typed-object INSERT in PutObject. The insert's conflict handling relies on reading the affected-row count; if the driver cannot report it, idempotency cannot be confirmed and the put fails.

Source

Thrown at engine/ccr/store_sqlite.go:534

		`INSERT INTO typed_objects (
		 object_id, object_type, content_hash, source, created_at, repository_state,
		 session_id, transform_version, currentness, lifecycle, dependencies_json,
		 original_byte_length, stored_byte_length, data
		) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)
		ON CONFLICT(object_id) DO NOTHING`,
		obj.ID, obj.Type, obj.ContentHash, obj.Source, obj.CreatedAt.Format(time.RFC3339Nano),
		obj.RepositoryState, obj.SessionID, obj.TransformVersion, obj.Currentness,
		obj.Lifecycle, string(deps), obj.OriginalByteLength, obj.StoredByteLength, obj.Data,
	)
	if err != nil {
		if isFull(err) {
			return "", fmt.Errorf("ccr typed object put: %w", ErrBudgetExceeded)
		}
		return "", fmt.Errorf("ccr typed object put: %w", err)
	}
	inserted, err := result.RowsAffected()
	if err != nil {
		return "", fmt.Errorf("ccr typed object put rows: %w", err)
	}
	if inserted == 0 {
		existing, err := s.GetObject(obj.ID)
		if err != nil {
			return "", fmt.Errorf("ccr typed object collision lookup: %w", err)
		}
		if !sameImmutableObject(existing, obj) {
			return "", errors.New("ccr: typed object id collision")
		}
	}
	return obj.ID, nil
}

func scanObject(scanner interface{ Scan(...any) error }) (Object, error) {
	var obj Object
	var created, deps string
	if err := scanner.Scan(
		&obj.ID, &obj.Type, &obj.ContentHash, &obj.Source, &created, &obj.RepositoryState,

View on GitHub (pinned to 766dce6b13)

Solutions

  1. Check the wrapped driver error
  2. Retry the idempotent put — ON CONFLICT DO NOTHING makes retries safe
  3. Verify the sqlite driver version supports RowsAffected reliably
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at engine/ccr/store_sqlite.go:534 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/3ca67606e29d3203. Report an issue: GitHub.