{"record":{"id":"16a4f9f54474a113","repo":"bytebase/bytebase","slug":"done-requires-a-non-empty-text-string","errorCode":null,"errorMessage":"done requires a non-empty text string","messagePattern":"done requires a non-empty text string","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/modules/agent/logic/tools/index.ts","lineNumber":76,"sourceCode":"    .filter((option): option is AgentAskUserOption => !!option);\n};\n\nconst parseAskUserKind = (\n  value: unknown,\n  options: AgentAskUserOption[]\n): AgentAskUserKind => {\n  if (value === \"confirm\") {\n    return \"confirm\";\n  }\n  if (value === \"choose\" && options.length > 0) {\n    return \"choose\";\n  }\n  return \"input\";\n};\n\nconst parseDoneArgs = (args: Record<string, unknown>): ToolExecutionResult => {\n  if (typeof args.text !== \"string\" || !args.text.trim()) {\n    throw new Error(\"done requires a non-empty text string\");\n  }\n  return {\n    kind: \"done\",\n    text: args.text,\n    success: args.success !== false,\n  };\n};\n\nconst parseAskUserArgs = (\n  args: Record<string, unknown>,\n  toolCallId: string\n): ToolExecutionResult => {\n  if (typeof args.prompt !== \"string\" || !args.prompt.trim()) {\n    throw new Error(\"ask_user requires a non-empty prompt string\");\n  }\n\n  const options = parseAskUserOptions(args.options);\n  const ask: AgentPendingAsk = {","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/bytebase/bytebase/blob/1870550677fe08f0d2a78c07acd27541464eb945/frontend/src/modules/agent/logic/tools/index.ts#L58-L94","documentation":"getIndexes fetches index comments (extended properties on indexes) in a separate rows iterator and maps them by objectID/indexID. If that iterator fails with rows.Err(), the whole index fetch fails with 'failed to fetch index comments'. The code's own comment says comments are not critical, yet the error is propagated and aborts getKeyAndIndexes.","triggerScenarios":"The comments query rows iterator hits a transport error mid-scan (connection reset, cancellation) or the extended_properties query on indexes fails against the target SQL Server edition or under restricted permissions.","commonSituations":"Long SyncDBSchema runs where the connection drops between sequential queries; sync accounts lacking catalog-view read permissions; Azure SQL vs on-prem differences in sys index metadata; idle connection reaping by firewalls/load balancers.","solutions":["Retry the schema sync once connectivity is confirmed stable","Log and continue: replace the return with a warning so indexes sync without comments, per the stated intent","Grant the sync login permission to read sys.extended_properties and index catalog views","Tune connection pool/idle timeouts (driver ConnParams, server keepalive) to survive long syncs"],"exampleFix":"// before\nif err := commentsRows.Err(); err != nil {\n    return nil, errors.Wrap(err, \"failed to fetch index comments\")\n}\n// after\nif err := commentsRows.Err(); err != nil {\n    log.Warn(\"failed to fetch index comments, continuing\", log.BBError(err))\n}","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Log-and-continue on extended_properties failures; comments never justify aborting index sync","Confirm sync account permissions on sys.extended_properties and index catalog views","Tune keepalive/idle settings to survive long-running SyncDBSchema sequences","Add an integration test that syncs a database with commented indexes"],"tags":["mssql","schema-sync","index-comments","metadata"],"backgroundTag":"database-query-failed","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"}