{"record":{"id":"43ca87419ed7517f","repo":"vitessio/vitess","slug":"could-not-set-message-v-v-43ca87","errorCode":null,"errorMessage":"could not set message: %v: %v","messagePattern":"could not set message: (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"go/vt/vttablet/tabletmanager/vreplication/vreplicator.go","lineNumber":546,"sourceCode":"\t}\n\tnumTablesToCopy, err = qr.Rows[0][0].ToCastInt64()\n\tif err != nil {\n\t\treturn settings, numTablesToCopy, err\n\t}\n\treturn settings, numTablesToCopy, nil\n}\n\nfunc (vr *vreplicator) setMessage(message string) (err error) {\n\tmessage = binlogplayer.MessageTruncate(message)\n\tvr.stats.History.Add(&binlogplayer.StatsHistoryRecord{\n\t\tTime:    time.Now(),\n\t\tMessage: message,\n\t})\n\tbuf := sqlparser.NewTrackedBuffer(nil)\n\tbuf.Myprintf(\"update _vt.vreplication set message=%s where id=%s\", encodeString(message), strconv.Itoa(int(vr.id)))\n\tquery := buf.ParsedQuery().Query\n\tif _, err := vr.dbClient.Execute(query); err != nil {\n\t\treturn fmt.Errorf(\"could not set message: %v: %v\", query, err)\n\t}\n\tinsertLog(vr.dbClient, LogMessage, vr.id, vr.state.String(), message)\n\treturn nil\n}\n\nfunc (vr *vreplicator) maxQuerySize(dbc *vdbClient) int64 {\n\tmaxQuerySize := int64(vr.workflowConfig.RelayLogMaxSize)\n\tres, err := dbc.DBClient.ExecuteFetch(SqlMaxAllowedPacket, 1)\n\tif err != nil {\n\t\tlog.Error(fmt.Sprintf(\"Error getting max_allowed_packet, will use the relay-log-max-size value of %d bytes: %v\", vr.workflowConfig.RelayLogMaxSize, err))\n\t} else {\n\t\tif maxQuerySize, err = res.Rows[0][0].ToInt64(); err != nil {\n\t\t\tlog.Error(fmt.Sprintf(\"Error getting max_allowed_packet, will use the relay-log-max-size value of %d bytes: %v\", vr.workflowConfig.RelayLogMaxSize, err))\n\t\t\tmaxQuerySize = int64(vr.workflowConfig.RelayLogMaxSize)\n\t\t}\n\t}\n\tif maxQuerySize > maxQuerySizeHeadroom {\n\t\tmaxQuerySize -= maxQuerySizeHeadroom","sourceCodeStart":528,"sourceCodeEnd":564,"githubUrl":"https://github.com/vitessio/vitess/blob/01a25a7d176f94613b8d59d799f438380a8760e4/go/vt/vttablet/tabletmanager/vreplication/vreplicator.go#L528-L564","documentation":"setMessage writes a human-readable status message into _vt.vreplication.message for this stream. If the UPDATE fails, this error wraps the query and the MySQL error. It usually signals the vreplication row is missing or the target MySQL is rejecting writes.","triggerScenarios":"The 'update _vt.vreplication set message=... where id=<id>' statement fails — e.g. the row was deleted concurrently, MySQL is read-only (super_read_only), or a lock/timeout kills the statement. Called from Replicate during message updates.","commonSituations":"Workflow row removed by a concurrent MoveTables/Reshard cancel while the stream is still running; target tablet MySQL flipped to read-only during maintenance; long lock hold on the _vt.vreplication row.","solutions":["Check the wrapped MySQL error: 1290 (read-only) means the target mysqld is in super_read_only — clear it; 1146/1032 means the row is gone.","Verify the _vt.vreplication row for this id still exists; if the workflow was cancelled elsewhere, stop this vreplicator instead of forcing writes.","Check for lock contention on _vt.vreplication from other workflows/clients and retry after it clears.","Restart the workflow (or the tablet) so the stream re-reads its state."],"exampleFix":"// before: target in super_read_only during maintenance\n// after: restore writability on the target mysqld\nSET GLOBAL super_read_only = OFF;\nSET GLOBAL read_only = OFF;","handlingStrategy":"retry","validationCode":"// Confirm the row exists and the target is writable:\n// SELECT id FROM _vt.vreplication WHERE id = <id>;\n// SHOW GLOBAL VARIABLES LIKE 'read_only';   -- expect OFF\n// SHOW GLOBAL VARIABLES LIKE 'super_read_only';","typeGuard":null,"tryCatchPattern":"if _, err := vr.dbClient.Execute(query); err != nil {\n\t// inspect mysql error code: 1290 -> read-only; 1146/1032 -> row gone\n\tlog.Warn(\"could not set vreplication message\", slog.Any(\"error\", err))\n\t// retry after read-only is cleared, or abandon the cancelled workflow\n}","preventionTips":["Clear read_only/super_read_only after maintenance before resuming workflows.","Do not cancel workflows concurrently with stream activity; stop then delete.","Avoid long manual locks on _vt.vreplication rows.","Use vtctldclient for all lifecycle operations."],"tags":["vreplication","mysql","state-update"],"backgroundTag":"vreplication-state-update-failed","analyzedSha":"01a25a7d176f94613b8d59d799f438380a8760e4","analyzedAt":"2026-09-01T17:28:30.605Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}