{"record":{"id":"d7506ef37ff7824b","repo":"bytebase/bytebase","slug":"string-array-payload-is-required-for-column-type-d","errorCode":null,"errorMessage":"string_array_payload is required for column type disallow list rule","messagePattern":"string_array_payload is required for column type disallow list rule","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/plugin/advisor/mssql/rule_column_type_disallow_list.go","lineNumber":35,"sourceCode":"\t_ advisor.Advisor = (*ColumnTypeDisallowListAdvisor)(nil)\n)\n\nfunc init() {\n\tadvisor.Register(storepb.Engine_MSSQL, storepb.SQLReviewRule_COLUMN_TYPE_DISALLOW_LIST, &ColumnTypeDisallowListAdvisor{})\n}\n\n// ColumnTypeDisallowListAdvisor is the advisor checking for disallowed types for column.\ntype ColumnTypeDisallowListAdvisor struct {\n}\n\nfunc (*ColumnTypeDisallowListAdvisor) Check(_ context.Context, checkCtx advisor.Context) ([]*storepb.Advice, error) {\n\tlevel, err := advisor.NewStatusBySQLReviewRuleLevel(checkCtx.Rule.Level)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tstringArrayPayload := checkCtx.Rule.GetStringArrayPayload()\n\tif stringArrayPayload == nil {\n\t\treturn nil, errors.New(\"string_array_payload is required for column type disallow list rule\")\n\t}\n\n\tdisallowTypes := make([]string, 0, len(stringArrayPayload.List))\n\tfor _, tp := range stringArrayPayload.List {\n\t\tdisallowTypes = append(disallowTypes, strings.ToUpper(tp))\n\t}\n\n\trule := &columnTypeDisallowListRule{\n\t\tOmniBaseRule:  OmniBaseRule{Level: level, Title: checkCtx.Rule.Type.String()},\n\t\tdisallowTypes: disallowTypes,\n\t}\n\treturn RunOmniRules(checkCtx.ParsedStatements, []OmniRule{rule}), nil\n}\n\ntype columnTypeDisallowListRule struct {\n\tOmniBaseRule\n\tdisallowTypes []string\n}","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/bytebase/bytebase/blob/1870550677fe08f0d2a78c07acd27541464eb945/backend/plugin/advisor/mssql/rule_column_type_disallow_list.go#L17-L53","documentation":"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.","triggerScenarios":"Executing Check for the column type disallow-list rule where the Rule proto lacks stringArrayPayload (e.g. rule saved with only type and level).","commonSituations":"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.","solutions":["Set stringArrayPayload.list to the disallowed column types (e.g. [\"TEXT\", \"NTEXT\", \"IMAGE\"]) on the rule.","Send camelCase stringArrayPayload in JSON requests; snake_case keys are silently dropped by protojson.","Validate at rule-save time that this rule type always includes the string array payload.","Re-save the rule from the SQL review settings UI to populate the payload correctly."],"exampleFix":"// before\n{\"type\": \"COLUMN_TYPE_DISALLOW_LIST\", \"level\": \"ERROR\"}\n// after\n{\"type\": \"COLUMN_TYPE_DISALLOW_LIST\", \"level\": \"ERROR\", \"stringArrayPayload\": {\"list\": [\"TEXT\", \"IMAGE\"]}}","handlingStrategy":"validation","validationCode":"if (rule.type === 'COLUMN_TYPE_DISALLOW_LIST' && !(rule.stringArrayPayload && rule.stringArrayPayload.list.length > 0)) {\n  throw new Error('COLUMN_TYPE_DISALLOW_LIST requires a non-empty stringArrayPayload.list')\n}","typeGuard":"func hasDisallowList(r *storepb.SQLReviewRule) bool {\n\tp := r.GetStringArrayPayload()\n\treturn p != nil && len(p.List) > 0\n}","tryCatchPattern":"advice, err := advisor.Check(ctx, rule, statement)\nif err != nil && strings.Contains(err.Error(), \"column type disallow list rule\") {\n  return nil, fmt.Errorf(\"rule %s misconfigured: supply the disallowed-type list in review settings\", rule.Type)\n}","preventionTips":["Populate stringArrayPayload.list with uppercase MSSQL type names (TEXT, NTEXT, IMAGE) when enabling the rule.","Use camelCase stringArrayPayload in JSON API calls — protojson drops snake_case keys.","Enforce payload presence per rule type in the save/validation path of SQL review config.","Keep a seeded default rule template that includes the payload so new instances never ship incomplete rules."],"tags":["mssql","sql-review","rule-config","validation"],"backgroundTag":"missing-required-argument","analyzedSha":"1870550677fe08f0d2a78c07acd27541464eb945","analyzedAt":"2026-09-06T21:16:13.665Z","contentChangedAt":"2026-09-06T21:16:13.665Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}