bytebase/bytebase · error

rule %s requires naming case payload

Error message

rule %s requires naming case payload

What it means

The NAMING_IDENTIFIER_CASE rule requires a naming_case_payload describing the required casing for identifiers (table, column, etc.). This error is thrown when the rule is present without that payload, so the naming checker has no target format to enforce.

Source

Thrown at backend/api/v1/review_config_service.go:447

		if len(payload.List) == 0 {
			return errors.Errorf("string array payload cannot be empty for rule %s", ruleType)
		}

	// Comment convention payload rules
	case storepb.SQLReviewRule_COLUMN_COMMENT, storepb.SQLReviewRule_TABLE_COMMENT:
		payload := rule.GetCommentConventionPayload()
		if payload == nil {
			return errors.Errorf("rule %s requires comment convention payload", ruleType)
		}
		if payload.MaxLength <= 0 {
			return errors.Errorf("comment convention max_length must be positive for rule %s, got %d", ruleType, payload.MaxLength)
		}

	// Naming case payload rules
	case storepb.SQLReviewRule_NAMING_IDENTIFIER_CASE:
		payload := rule.GetNamingCasePayload()
		if payload == nil {
			return errors.Errorf("rule %s requires naming case payload", ruleType)
		}
		// Upper field is boolean, no value validation needed

	// Rules that explicitly should NOT have payloads
	case storepb.SQLReviewRule_NAMING_FULLY_QUALIFIED,
		storepb.SQLReviewRule_STATEMENT_MAX_EXECUTION_TIME,
		storepb.SQLReviewRule_COLUMN_CURRENT_TIME_COUNT_LIMIT,
		storepb.SQLReviewRule_ENGINE_MYSQL_USE_INNODB,
		storepb.SQLReviewRule_NAMING_TABLE_NO_KEYWORD,
		storepb.SQLReviewRule_NAMING_IDENTIFIER_NO_KEYWORD,
		storepb.SQLReviewRule_STATEMENT_SELECT_NO_SELECT_ALL,
		storepb.SQLReviewRule_STATEMENT_WHERE_REQUIRE_SELECT,
		storepb.SQLReviewRule_STATEMENT_WHERE_REQUIRE_UPDATE_DELETE,
		storepb.SQLReviewRule_STATEMENT_WHERE_NO_LEADING_WILDCARD_LIKE,
		storepb.SQLReviewRule_STATEMENT_DISALLOW_ON_DEL_CASCADE,
		storepb.SQLReviewRule_STATEMENT_DISALLOW_RM_TBL_CASCADE,
		storepb.SQLReviewRule_STATEMENT_DISALLOW_TRUNCATE,
		storepb.SQLReviewRule_STATEMENT_DISALLOW_COMMIT,

View on GitHub (pinned to 1870550677)

Solutions

  1. Provide naming_case_payload with the desired casing for each identifier kind
  2. Remove the naming rule if identifier casing should not be enforced
  3. Inspect the rule payload in the API response to confirm which field was omitted

Example fix

// before
{"type": "SQL_REVIEW_RULE_NAMING_IDENTIFIER_CASE"}
// after
{"type": "SQL_REVIEW_RULE_NAMING_IDENTIFIER_CASE", "namingCasePayload": {"table": {"format": "SNAKE_LOWER_CASE"}}}
Defensive patterns

Strategy: validation

Validate before calling

if (rule.type === 'SQL_REVIEW_RULE_NAMING_IDENTIFIER_CASE' && rule.namingCasePayload == null) {
  throw new Error('NAMING_IDENTIFIER_CASE requires namingCasePayload');
}

Type guard

function hasNamingCasePayload(r) {
  return r.namingCasePayload != null && Object.keys(r.namingCasePayload).length > 0;
}

Try / catch

try {
  await reviewConfigService.UpdateReviewConfig(req);
} catch (e) {
  if (e.message.includes('requires naming case payload')) {
    // configure identifier casing and resubmit
  }
  throw e;
}

Prevention

When it happens

Trigger: Saving a SQL review config containing SQL_REVIEW_RULE_NAMING_IDENTIFIER_CASE without naming_case_payload set, or with the wrong payload variant.

Common situations: Naming rule enabled in UI but casing options never configured; config generated from a template missing the payload; hand-edited JSON dropped the field.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


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