{"record":{"id":"c804e1fcb58200f7","repo":"vitessio/vitess","slug":"unable-to-perform-time-zone-conversions-from-s-to","errorCode":null,"errorMessage":"unable to perform time_zone conversions from %s to UTC — value from DB was: %+v and the 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 — value from DB was: %\\+v and the 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":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vtctl/workflow/materializer.go","lineNumber":672,"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 := forAllShards(mz.targetShards, func(target *topo.ShardInfo) error {\n\t\ttargetPrimary, err := mz.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.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 — value from DB was: %+v and the 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, qr.Rows, 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":654,"sourceCodeEnd":690,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vtctl/workflow/materializer.go#L654-L690","documentation":"During validation of time_zone conversions for a materialize workflow, the code writes a test datetime to the target and reads it back, expecting the UTC-converted value to parse. If parsing fails, either the configured source time zone is invalid or the MySQL time zone tables are not loaded on the target tablet, so CONVERT_TZ-based timezone conversion cannot work.","triggerScenarios":"Workflow with TimeZoneConversion enabled executes its validation query against the target primary; the round-tripped value cannot be parsed as the expected datetime format, indicating bad tz config or missing MySQL timezone tables on the tablet.","commonSituations":"Typo in the --time-zone option (e.g. 'America/New_Yorke'); MySQL time zone tables never loaded on the tablet host (mysql_tzinfo_to_sql not run); container images stripped of /usr/share/zoneinfo.","solutions":["Load the MySQL time zone tables on the target tablet host: run mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql","Verify the --time-zone value is a valid IANA time zone name and correct any typo","Restart/re-provision the tablet with an image that includes zoneinfo, then retry the workflow"],"exampleFix":"// before\nMoveTables --time-zone=Ameria/New_York ...\n// after\nmysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql\nMoveTables --time-zone=America/New_York ...","handlingStrategy":"validation","validationCode":"_, err := time.LoadLocation(tz)\nif err != nil {\n    return fmt.Errorf(\"invalid time zone %q: %w\", tz, err)\n}","typeGuard":null,"tryCatchPattern":"if err := createWorkflow(ctx, req); err != nil {\n    if strings.Contains(err.Error(), \"time_zone conversions\") {\n        // validate tz name and load mysql timezone tables on tablets\n    }\n    return err\n}","preventionTips":["Validate the --time-zone flag with time.LoadLocation before running the workflow","Bake mysql_tzinfo_to_sql setup into tablet provisioning","Use container images that ship /usr/share/zoneinfo"],"tags":["vitess","workflow","materialize","timezone","mysql"],"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"}