bytebase/bytebase · error
Google Cloud Translation API Error: ${data.error?.message ||
Error message
Google Cloud Translation API Error: ${data.error?.message || "Unknown error"}\nPlease create .env.i18n locally and set GOOGLE_TRANSLATE_API_KEY=xxx. What it means
During SQL Server metadata sync, getTableColumns runs a secondary query fetching sys.extended_properties column comments into a separate rows iterator. If iterating those rows fails (rows.Err()), the sync aborts with 'failed to fetch column comments'. Although the code intends comments to be non-critical, the current implementation returns an error instead of continuing.
Source
Thrown at frontend/i18n.ts:72
}
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
q: sourceText,
target: targetLang,
source: SOURCE_LANG.split("-")[0],
format: "text",
}),
});
const data = await response.json();
if (!response.ok) {
throw new Error(
`Google Cloud Translation API Error: ${data.error?.message || "Unknown error"}\nPlease create .env.i18n locally and set GOOGLE_TRANSLATE_API_KEY=xxx.`
);
}
let translatedText = data.data.translations[0].translatedText;
for (const replacement of replacements) {
translatedText = translatedText.replace(
replacement.target,
replacement.source
);
}
return translatedText;
}
// Function specifically for JsonObject translation
async function translateJsonObject(
obj: JsonObject,
targetLang: stringView on GitHub (pinned to 1870550677)
Solutions
- Check SQL Server connectivity/stability (connection lifetime, keepalives, proxy timeouts) and retry the schema sync
- Downgrade this to a logged warning: replace the return with a log statement so sync continues without comments, matching the comment's stated intent
- Verify the mssql driver version and the query against the target SQL Server/Azure SQL edition; adjust the extended_properties query for compatibility
- Ensure each rows iterator is closed (defer rows.Close()) before running the next query on the same connection to avoid resource conflicts
Example fix
// before
if err := commentsRows.Err(); err != nil {
return nil, errors.Wrap(err, "failed to fetch column comments")
}
// after
if err := commentsRows.Err(); err != nil {
log.Warn("failed to fetch column comments, continuing", log.BBError(err))
} Defensive patterns
Strategy: fallback
Prevention
- Check rows.Err() after every iterator loop and log non-critical metadata failures instead of failing the whole sync
- Keep connections alive for multi-query syncs: set reasonable pool idle timeouts and avoid proxies that reap idle connections
- Test the sync against the exact SQL Server/Azure SQL edition in use, especially around sys.extended_properties
- Ensure every rows iterator is closed before issuing the next query on the same connection
When it happens
Trigger: The comment query's rows iterator encounters a driver/network error during Rows.Next()/Err(), e.g. connection dropped mid-iteration after the initial query succeeded, or the query text is rejected by a specific SQL Server version (e.g. missing extended_properties support or sys.columns changes).
Common situations: Flaky network or SQL Server connection pool timeouts during long schema syncs; querying Azure SQL or older SQL Server editions where system catalog behavior differs; TLS/proxy dropping idle connections between the multi-statement sequence.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- The plan was created, but its Draft Review Issue was not cre
- done requires a non-empty text string
- ask_user requires a non-empty prompt string
- column type name is not valid
- failed to sync database schema for database %q
AI-assisted analysis of bytebase/bytebase@1870550677 (2026-09-06).
Data as JSON: /api/errors/a46735ee1ba0e259.
Report an issue: GitHub.