bytebase/bytebase · error

string_array_payload is required for column type disallow li

Error message

string_array_payload is required for column type disallow list rule

What it means

The MSSQL 'column type disallow list' SQL review rule requires a string-array payload enumerating forbidden column types. When Check finds GetStringArrayPayload() returning nil, it cannot build the disallow list and returns this error.

Source

Thrown at backend/plugin/advisor/mssql/rule_column_type_disallow_list.go:35

	_ advisor.Advisor = (*ColumnTypeDisallowListAdvisor)(nil)
)

func init() {
	advisor.Register(storepb.Engine_MSSQL, storepb.SQLReviewRule_COLUMN_TYPE_DISALLOW_LIST, &ColumnTypeDisallowListAdvisor{})
}

// ColumnTypeDisallowListAdvisor is the advisor checking for disallowed types for column.
type ColumnTypeDisallowListAdvisor struct {
}

func (*ColumnTypeDisallowListAdvisor) Check(_ context.Context, checkCtx advisor.Context) ([]*storepb.Advice, error) {
	level, err := advisor.NewStatusBySQLReviewRuleLevel(checkCtx.Rule.Level)
	if err != nil {
		return nil, err
	}
	stringArrayPayload := checkCtx.Rule.GetStringArrayPayload()
	if stringArrayPayload == nil {
		return nil, errors.New("string_array_payload is required for column type disallow list rule")
	}

	disallowTypes := make([]string, 0, len(stringArrayPayload.List))
	for _, tp := range stringArrayPayload.List {
		disallowTypes = append(disallowTypes, strings.ToUpper(tp))
	}

	rule := &columnTypeDisallowListRule{
		OmniBaseRule:  OmniBaseRule{Level: level, Title: checkCtx.Rule.Type.String()},
		disallowTypes: disallowTypes,
	}
	return RunOmniRules(checkCtx.ParsedStatements, []OmniRule{rule}), nil
}

type columnTypeDisallowListRule struct {
	OmniBaseRule
	disallowTypes []string
}

View on GitHub (pinned to 1870550677)

Solutions

  1. Set stringArrayPayload.list to the disallowed column types (e.g. ["TEXT", "NTEXT", "IMAGE"]) on the rule.
  2. Send camelCase stringArrayPayload in JSON requests; snake_case keys are silently dropped by protojson.
  3. Validate at rule-save time that this rule type always includes the string array payload.
  4. Re-save the rule from the SQL review settings UI to populate the payload correctly.

Example fix

// before
{"type": "COLUMN_TYPE_DISALLOW_LIST", "level": "ERROR"}
// after
{"type": "COLUMN_TYPE_DISALLOW_LIST", "level": "ERROR", "stringArrayPayload": {"list": ["TEXT", "IMAGE"]}}
Defensive patterns

Strategy: validation

Validate before calling

if (rule.type === 'COLUMN_TYPE_DISALLOW_LIST' && !(rule.stringArrayPayload && rule.stringArrayPayload.list.length > 0)) {
  throw new Error('COLUMN_TYPE_DISALLOW_LIST requires a non-empty stringArrayPayload.list')
}

Type guard

func hasDisallowList(r *storepb.SQLReviewRule) bool {
	p := r.GetStringArrayPayload()
	return p != nil && len(p.List) > 0
}

Try / catch

advice, err := advisor.Check(ctx, rule, statement)
if err != nil && strings.Contains(err.Error(), "column type disallow list rule") {
  return nil, fmt.Errorf("rule %s misconfigured: supply the disallowed-type list in review settings", rule.Type)
}

Prevention

When it happens

Trigger: Executing Check for the column type disallow-list rule where the Rule proto lacks stringArrayPayload (e.g. rule saved with only type and level).

Common situations: Rule provisioning scripts that set the rule type but skip the payload; JSON sent with snake_case string_array_payload key so protojson drops it; templates copied from unrelated rule types.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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