{"record":{"id":"632b10d97b0474d4","repo":"vitessio/vitess","slug":"unable-to-perform-time-zone-conversions-from-s-to-632b10","errorCode":null,"errorMessage":"unable to perform time_zone conversions from %s to UTC — result of the attempt was: %s. Either the specified source time zone is invalid or the time zone tables have not been loaded on the %s tablet","messagePattern":"unable to perform time_zone conversions from (.+?) to UTC — result of the attempt was: (.+?)\\. Either the specified source time zone is invalid or the time zone tables have not been loaded on the (.+?) tablet","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/wrangler/materializer.go","lineNumber":1575,"sourceCode":"// gets elected: in this case user will either see errors during vreplication or vdiff will report mismatches.\nfunc (mz *materializer) checkTZConversion(ctx context.Context, tz string) error {\n\terr := mz.forAllTargets(func(target *topo.ShardInfo) error {\n\t\ttargetPrimary, err := mz.wr.ts.GetTablet(ctx, target.PrimaryAlias)\n\t\tif err != nil {\n\t\t\treturn vterrors.Wrapf(err, \"GetTablet(%v) failed\", target.PrimaryAlias)\n\t\t}\n\t\ttestDateTime := \"2006-01-02 15:04:05\"\n\t\tquery := fmt.Sprintf(\"select convert_tz(%s, %s, 'UTC')\", encodeString(testDateTime), encodeString(tz))\n\t\tqrproto, err := mz.wr.tmc.ExecuteFetchAsApp(ctx, targetPrimary.Tablet, false, &tabletmanagerdatapb.ExecuteFetchAsAppRequest{\n\t\t\tQuery:   []byte(query),\n\t\t\tMaxRows: 1,\n\t\t})\n\t\tif err != nil {\n\t\t\treturn vterrors.Wrapf(err, \"ExecuteFetchAsApp(%v, %s)\", targetPrimary.Tablet, query)\n\t\t}\n\t\tqr := sqltypes.Proto3ToResult(qrproto)\n\t\tif gotDate, err := time.Parse(testDateTime, qr.Rows[0][0].ToString()); err != nil {\n\t\t\treturn fmt.Errorf(\"unable to perform time_zone conversions from %s to UTC — result of the attempt was: %s. Either the specified source time zone is invalid or the time zone tables have not been loaded on the %s tablet\",\n\t\t\t\ttz, gotDate, targetPrimary.Alias)\n\t\t}\n\t\treturn nil\n\t})\n\treturn err\n}\n\n// filterSourceShards filters out source shards that do not overlap with the\n// provided target shard. This is an optimization to avoid copying unnecessary\n// data between the shards. This optimization is only applied for MoveTables\n// when the source and target shard have the same primary vindexes.\nfunc (mz *materializer) filterSourceShards(targetShard *topo.ShardInfo) []*topo.ShardInfo {\n\tif mz.primaryVindexesDiffer || mz.ms.MaterializationIntent != vtctldatapb.MaterializationIntent_MOVETABLES {\n\t\t// Use all source shards.\n\t\treturn mz.sourceShards\n\t}\n\t// Use intersecting source shards.\n\tvar filteredSourceShards []*topo.ShardInfo","sourceCodeStart":1557,"sourceCodeEnd":1593,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/wrangler/materializer.go#L1557-L1593","documentation":"When the MaterializeSettings specifies a source time zone (tz conversion), the materializer validates that MySQL can convert a test datetime from that zone to UTC by executing a query on the target primary. If the result cannot be parsed back as a datetime, either the time zone name is invalid on the server or the MySQL time zone tables are not loaded on that tablet.","triggerScenarios":"MaterializeSettings with a SourceTimeZone (or related tz config) where the target primary tablet's mysqld lacks time zone tables (`SELECT CONVERT_TZ(...)` returns NULL) or the tz string is misspelled/unknown (e.g. 'America/New_Yorlk').","commonSituations":"MySQL installed without the mysql.time_zone* tables populated (mysql_tzinfo_to_sql not run); custom container images missing /usr/share/zoneinfo; typo in the IANA time zone name in workflow config.","solutions":["Load time zone tables on the tablet's MySQL: run `mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql`","Verify with `SELECT CONVERT_TZ('2023-01-01 12:00:00','UTC','<your-tz>');` returning non-NULL","Fix the time zone name typo in the workflow settings (must be a valid IANA name like 'America/New_York')","Restart the workflow after fixing the tablet environment"],"exampleFix":"// before (on tablet host)\n# mysql time zone tables missing\n// after\nmysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql\n# then verify\nmysql -e \"SELECT CONVERT_TZ('2023-01-01 12:00:00','UTC','America/New_York');\"","handlingStrategy":"validation","validationCode":"qr, err := conn.ExecuteFetch(\"SELECT CONVERT_TZ('2023-01-01 12:00:00','UTC','\"+tz+\"')\", 1, false)\nif err != nil || qr.Rows[0][0].IsNull() || qr.Rows[0][0].ToString() == \"NULL\" {\n    return fmt.Errorf(\"time zone %s unusable on tablet: load tz tables via mysql_tzinfo_to_sql\", tz)\n}","typeGuard":null,"tryCatchPattern":"if err := workflow.Start(ctx); err != nil {\n    if strings.Contains(err.Error(), \"unable to perform time_zone conversions\") {\n        log.Error(\"Load tz tables: mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql\", slog.Any(\"error\", err))\n    }\n}","preventionTips":["Run mysql_tzinfo_to_sql on every mysqld container image","Verify CONVERT_TZ works on tablets before timezone-aware workflows","Validate IANA tz names in configs with time.LoadLocation"],"tags":["vitess","wrangler","mysql","timezone","environment"],"backgroundTag":"timezone-tables-not-loaded","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}