bytebase/bytebase · error
failed to fetch index comments
Error message
failed to fetch index comments
What it means
MSSQL getIndexes: the query for index comments (sys.extended_properties class 7) failed or its iteration errored. Comments are supplementary to index metadata; the wrapped error lets the sync report the partial failure.
Source
Thrown at backend/plugin/db/mssql/sync.go:828
CAST(ep.value AS NVARCHAR(MAX)) AS comment
FROM sys.extended_properties ep
WHERE ep.class = 7 AND ep.name = 'MS_Description' AND ep.minor_id > 0`
commentsRows, err := txn.Query(commentsQuery)
if err == nil {
defer commentsRows.Close()
for commentsRows.Next() {
var objectID, indexID int
var comment sql.NullString
if err := commentsRows.Scan(&objectID, &indexID, &comment); err != nil {
continue
}
if comment.Valid {
indexCommentsMap[struct{ ObjectID, IndexID int }{objectID, indexID}] = comment.String
}
}
if err := commentsRows.Err(); err != nil {
// Log error but continue - comments are not critical
return nil, errors.Wrap(err, "failed to fetch index comments")
}
}
query := fmt.Sprintf(`
SELECT
s.name AS schema_name,
o.name AS table_name,
i.object_id,
i.index_id,
i.name,
i.type_desc,
col.name AS column_name,
ic.is_descending_key
FROM sys.indexes i
INNER JOIN sys.all_objects o ON o.object_id = i.object_id
INNER JOIN sys.schemas s ON s.schema_id = o.schema_id
INNER JOIN sys.index_columns ic ON ic.object_id = i.object_id AND ic.index_id = i.index_id
INNER JOIN sys.all_columns col ON ic.column_id = col.column_id AND ic.object_id = col.object_idView on GitHub (pinned to 1870550677)
Solutions
- Retry the schema sync
- Check permissions on sys.extended_properties
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at backend/plugin/db/mssql/sync.go:828 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of bytebase/bytebase@1870550677 (2026-09-06).
Data as JSON: /api/errors/d73a1c81fe261373.
Report an issue: GitHub.