bytebase/bytebase · error

failed to convert assume-rbr %q to bool

Error message

failed to convert assume-rbr %q to bool

What it means

GetUserFlags parses gh-ost boolean flags from user config. When 'assume-rbr' is present but strconv.ParseBool cannot interpret it, this wrapped error is returned. This flag asserts row-based replication is already enabled and must be a strict boolean literal.

Source

Thrown at backend/component/ghost/config.go:184

	}
	if v, ok := flags["allow-on-master"]; ok {
		allowOnMaster, err := strconv.ParseBool(v)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to convert allow-on-master %q to bool", v)
		}
		f.allowOnMaster = &allowOnMaster
	}
	if v, ok := flags["switch-to-rbr"]; ok {
		switchToRBR, err := strconv.ParseBool(v)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to convert switch-to-rbr %q to bool", v)
		}
		f.switchToRBR = &switchToRBR
	}
	if v, ok := flags["assume-rbr"]; ok {
		assumeRBR, err := strconv.ParseBool(v)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to convert assume-rbr %q to bool", v)
		}
		f.assumeRBR = &assumeRBR
	}
	if v, ok := flags["heartbeat-interval-millis"]; ok {
		heartbeatIntervalMillis, err := strconv.ParseInt(v, 10, 64)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to convert heartbeat-interval-millis %q to int", v)
		}
		f.heartbeatIntervalMillis = &heartbeatIntervalMillis
	}
	if v, ok := flags["nice-ratio"]; ok {
		niceRatio, err := strconv.ParseFloat(v, 64)
		if err != nil {
			return nil, errors.Wrapf(err, "failed to convert nice-ratio %q to float", v)
		}
		f.niceRatio = &niceRatio
	}
	if v, ok := flags["throttle-control-replicas"]; ok {

View on GitHub (pinned to 1870550677)

Solutions

  1. Set 'assume-rbr' to "true" or "false" explicitly
  2. Remove the flag when row-based replication status is unknown
  3. Verify the stored value for empty string or typos
  4. Re-save settings and retry the migration

Example fix

// before
flags["assume-rbr"] = "" // flag passed bare on CLI
// after
flags["assume-rbr"] = "true"
Defensive patterns

Strategy: validation

Validate before calling

if v, ok := flags["assume-rbr"]; ok {
    if _, err := strconv.ParseBool(strings.TrimSpace(v)); err != nil {
        return fmt.Errorf("assume-rbr must be true/false, got %q", v)
    }
}

Type guard

func isValidBoolFlag(v string) bool {
    _, err := strconv.ParseBool(v)
    return err == nil
}

Try / catch

assumeRBR, err := strconv.ParseBool(v)
if err != nil {
    return nil, errors.Wrapf(err, "failed to convert assume-rbr %q to bool", v)
}

Prevention

When it happens

Trigger: Calling GetUserFlags (via getTaskCreatesFromChangeDatabaseConfig or NewMigrationContext) with a flags map containing "assume-rbr" set to values like "yes", "true1" or the empty string.

Common situations: Users mirror gh-ost CLI usage where the flag is passed bare (meaning true) but the config map requires an explicit string value.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of bytebase/bytebase@1870550677 (2026-09-06). Data as JSON: /api/errors/977a8abdccbf87b4. Report an issue: GitHub.