multica-ai/multica · error

count attribution mismatches: %w

Error message

count attribution mismatches: %w

What it means

Error "count attribution mismatches: %w" thrown in multica-ai/multica.

Source

Thrown at server/internal/attributionbackfill/backfill.go:179

	if log == nil {
		log = slog.Default()
	}
	batchSize := opts.BatchSize
	if batchSize <= 0 {
		batchSize = DefaultBatchSize
	}
	table := opts.Table
	if table == "" {
		table = "agent_task_queue"
	}

	var res Result

	// Surface any genuinely mis-attributed rows (both users set but
	// different) up front. The invariant still forces accountable to follow
	// originator below, but the operator/audit trail should show the count.
	if err := pool.QueryRow(ctx, fmt.Sprintf(countMismatchSQL, table)).Scan(&res.MismatchNormalized); err != nil {
		return res, fmt.Errorf("count attribution mismatches: %w", err)
	}
	if res.MismatchNormalized > 0 {
		log.Warn("attribution backfill: normalizing rows where accountable_user_id disagreed with a non-NULL originator_user_id; originator is authoritative but these are worth auditing",
			"mismatch_rows", res.MismatchNormalized)
	}

	updateSQL := fmt.Sprintf(backfillBatchSQL, table, table)
	for {
		tag, err := pool.Exec(ctx, updateSQL, batchSize)
		if err != nil {
			return res, fmt.Errorf("backfill accountable_user_id batch: %w", err)
		}
		n := tag.RowsAffected()
		if n == 0 {
			break
		}
		res.RowsBackfilled += n
		res.Batches++

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Investigate the attribution count mismatches; inspect the wrapped error and re-run the backfill.

When it happens

Trigger: Thrown at server/internal/attributionbackfill/backfill.go:179 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/a13b815d1e23c2fc. Report an issue: GitHub.