{"record":{"id":"6229941576ae5ecd","repo":"gastownhall/beads","slug":"scan-tag-w","errorCode":null,"errorMessage":"scan tag: %w","messagePattern":"scan tag: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/storage/versioncontrolops/remoterefs.go","lineNumber":65,"sourceCode":"\t}\n\treturn pruned, nil\n}\n\n// ListTags returns the names of all Dolt tags, sorted by name. Tags anchor\n// history the same way remote-tracking refs do, but they are user-created, so\n// callers should surface them rather than delete them.\nfunc ListTags(ctx context.Context, db DBConn) ([]string, error) {\n\trows, err := db.QueryContext(ctx, \"SELECT tag_name FROM dolt_tags ORDER BY tag_name\")\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"list tags: %w\", err)\n\t}\n\tdefer rows.Close()\n\n\tvar tags []string\n\tfor rows.Next() {\n\t\tvar name string\n\t\tif err := rows.Scan(&name); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"scan tag: %w\", err)\n\t\t}\n\t\ttags = append(tags, name)\n\t}\n\treturn tags, rows.Err()\n}\n","sourceCodeStart":47,"sourceCodeEnd":71,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/internal/storage/versioncontrolops/remoterefs.go#L47-L71","documentation":"ListTags scans each row from dolt_tags into a string via rows.Scan. This error wraps a per-row scan failure — the driver could not convert a tag_name value (NULL or non-string type) into a Go string, or the row shape is unexpected. It distinguishes data-shape problems in the tag table from the query-level failure reported by the list-tags error.","triggerScenarios":"A dolt_tags row has a NULL or non-string tag_name that cannot scan into *string; the Dolt engine returns dolt_tags with altered column types after a version change.","commonSituations":"Corrupted tag metadata after a failed migration or abrupt shutdown; Dolt upgrade/downgrade changing dolt_tags column types; NULL tag names from an interrupted DOLT_TAG operation.","solutions":["Inspect the wrapped error to identify the type mismatch on tag_name.","Query SELECT tag_name FROM dolt_tags directly to locate NULL/malformed rows and repair or remove them.","If metadata is corrupted after a version change, re-initialize or migrate the Dolt database properly.","Verify rows.Err() after iteration to catch iteration-level failures separately."],"exampleFix":"// before\nvar name string\nif err := rows.Scan(&name); err != nil {\n    return nil, fmt.Errorf(\"scan tag: %w\", err)\n}\n// after: tolerate NULLs with sql.NullString\nvar name sql.NullString\nif err := rows.Scan(&name); err != nil {\n    return nil, fmt.Errorf(\"scan tag: %w\", err)\n}\nif !name.Valid { continue }","handlingStrategy":"validation","validationCode":"rows, err := db.QueryContext(ctx, \"SELECT tag_name FROM dolt_tags WHERE tag_name IS NOT NULL ORDER BY tag_name\")\nif err != nil {\n    return err\n}","typeGuard":null,"tryCatchPattern":"tags, err := versioncontrolops.ListTags(ctx, db)\nvar scanErr *sql.ScanError\nif err != nil && errors.As(err, &scanErr) {\n    log.Printf(\"malformed tag row: %v\", err)\n    tags, err = queryTagsManually(ctx, db) // fallback raw query\n}","preventionTips":["Use sql.NullString or filter NULLs when reading dolt_tags.","Check rows.Err() after iteration to catch iteration-level failures.","Re-validate tag metadata after Dolt version upgrades/migrations.","Never interrupt DOLT_TAG operations; abrupt shutdowns can leave malformed rows."],"tags":["dolt","sql","row-scan"],"backgroundTag":"sql-row-scan-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}