{"record":{"id":"b44363118e317d02","repo":"multica-ai/multica","slug":"backfill-accountable-user-id-batch-w","errorCode":null,"errorMessage":"backfill accountable_user_id batch: %w","messagePattern":"backfill accountable_user_id batch: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/attributionbackfill/backfill.go","lineNumber":190,"sourceCode":"\n\tvar res Result\n\n\t// Surface any genuinely mis-attributed rows (both users set but\n\t// different) up front. The invariant still forces accountable to follow\n\t// originator below, but the operator/audit trail should show the count.\n\tif err := pool.QueryRow(ctx, fmt.Sprintf(countMismatchSQL, table)).Scan(&res.MismatchNormalized); err != nil {\n\t\treturn res, fmt.Errorf(\"count attribution mismatches: %w\", err)\n\t}\n\tif res.MismatchNormalized > 0 {\n\t\tlog.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\",\n\t\t\t\"mismatch_rows\", res.MismatchNormalized)\n\t}\n\n\tupdateSQL := fmt.Sprintf(backfillBatchSQL, table, table)\n\tfor {\n\t\ttag, err := pool.Exec(ctx, updateSQL, batchSize)\n\t\tif err != nil {\n\t\t\treturn res, fmt.Errorf(\"backfill accountable_user_id batch: %w\", err)\n\t\t}\n\t\tn := tag.RowsAffected()\n\t\tif n == 0 {\n\t\t\tbreak\n\t\t}\n\t\tres.RowsBackfilled += n\n\t\tres.Batches++\n\t\tlog.Info(\"attribution backfill: batch reconciled\",\n\t\t\t\"rows\", n,\n\t\t\t\"total\", res.RowsBackfilled)\n\t}\n\n\tif res.RowsBackfilled == 0 {\n\t\tlog.Info(\"attribution backfill: no rows needed reconciliation before migration 198\")\n\t} else {\n\t\tlog.Info(\"attribution backfill: complete\",\n\t\t\t\"rows_backfilled\", res.RowsBackfilled,\n\t\t\t\"batches\", res.Batches,","sourceCodeStart":172,"sourceCodeEnd":208,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/attributionbackfill/backfill.go#L172-L208","documentation":"Error \"backfill accountable_user_id batch: %w\" thrown in multica-ai/multica.","triggerScenarios":"Thrown at server/internal/attributionbackfill/backfill.go:190 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped database error and re-run the backfill batch."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}