{"record":{"id":"d73a1c81fe261373","repo":"bytebase/bytebase","slug":"failed-to-fetch-index-comments","errorCode":null,"errorMessage":"failed to fetch index comments","messagePattern":"failed to fetch index comments","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/plugin/db/mssql/sync.go","lineNumber":828,"sourceCode":"\t\tCAST(ep.value AS NVARCHAR(MAX)) AS comment\n\tFROM sys.extended_properties ep\n\tWHERE ep.class = 7 AND ep.name = 'MS_Description' AND ep.minor_id > 0`\n\tcommentsRows, err := txn.Query(commentsQuery)\n\tif err == nil {\n\t\tdefer commentsRows.Close()\n\t\tfor commentsRows.Next() {\n\t\t\tvar objectID, indexID int\n\t\t\tvar comment sql.NullString\n\t\t\tif err := commentsRows.Scan(&objectID, &indexID, &comment); err != nil {\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\tif comment.Valid {\n\t\t\t\tindexCommentsMap[struct{ ObjectID, IndexID int }{objectID, indexID}] = comment.String\n\t\t\t}\n\t\t}\n\t\tif err := commentsRows.Err(); err != nil {\n\t\t\t// Log error but continue - comments are not critical\n\t\t\treturn nil, errors.Wrap(err, \"failed to fetch index comments\")\n\t\t}\n\t}\n\n\tquery := fmt.Sprintf(`\n\tSELECT\n\t\ts.name AS schema_name,\n\t\to.name AS table_name,\n\t\ti.object_id,\n\t\ti.index_id,\n\t\ti.name,\n\t\ti.type_desc,\n\t\tcol.name AS column_name,\n\t\tic.is_descending_key\n\tFROM sys.indexes i\n\tINNER JOIN sys.all_objects o ON o.object_id = i.object_id\n\tINNER JOIN sys.schemas s ON s.schema_id = o.schema_id\n\tINNER JOIN sys.index_columns ic ON ic.object_id = i.object_id AND ic.index_id = i.index_id\n\tINNER JOIN sys.all_columns col ON ic.column_id = col.column_id AND ic.object_id = col.object_id","sourceCodeStart":810,"sourceCodeEnd":846,"githubUrl":"https://github.com/bytebase/bytebase/blob/1870550677fe08f0d2a78c07acd27541464eb945/backend/plugin/db/mssql/sync.go#L810-L846","documentation":"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.","triggerScenarios":"Thrown at backend/plugin/db/mssql/sync.go:828 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the schema sync","Check permissions on sys.extended_properties"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1870550677fe08f0d2a78c07acd27541464eb945","analyzedAt":"2026-09-06T21:16:13.665Z","contentChangedAt":"2026-09-06T21:16:13.665Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}