{"record":{"id":"17c0df605ea9a04b","repo":"bytebase/bytebase","slug":"rule-s-requires-naming-case-payload","errorCode":null,"errorMessage":"rule %s requires naming case payload","messagePattern":"rule (.+?) requires naming case payload","errorType":"validation","errorClass":null,"httpStatus":400,"severity":"error","filePath":"backend/api/v1/review_config_service.go","lineNumber":447,"sourceCode":"\t\tif len(payload.List) == 0 {\n\t\t\treturn errors.Errorf(\"string array payload cannot be empty for rule %s\", ruleType)\n\t\t}\n\n\t// Comment convention payload rules\n\tcase storepb.SQLReviewRule_COLUMN_COMMENT, storepb.SQLReviewRule_TABLE_COMMENT:\n\t\tpayload := rule.GetCommentConventionPayload()\n\t\tif payload == nil {\n\t\t\treturn errors.Errorf(\"rule %s requires comment convention payload\", ruleType)\n\t\t}\n\t\tif payload.MaxLength <= 0 {\n\t\t\treturn errors.Errorf(\"comment convention max_length must be positive for rule %s, got %d\", ruleType, payload.MaxLength)\n\t\t}\n\n\t// Naming case payload rules\n\tcase storepb.SQLReviewRule_NAMING_IDENTIFIER_CASE:\n\t\tpayload := rule.GetNamingCasePayload()\n\t\tif payload == nil {\n\t\t\treturn errors.Errorf(\"rule %s requires naming case payload\", ruleType)\n\t\t}\n\t\t// Upper field is boolean, no value validation needed\n\n\t// Rules that explicitly should NOT have payloads\n\tcase storepb.SQLReviewRule_NAMING_FULLY_QUALIFIED,\n\t\tstorepb.SQLReviewRule_STATEMENT_MAX_EXECUTION_TIME,\n\t\tstorepb.SQLReviewRule_COLUMN_CURRENT_TIME_COUNT_LIMIT,\n\t\tstorepb.SQLReviewRule_ENGINE_MYSQL_USE_INNODB,\n\t\tstorepb.SQLReviewRule_NAMING_TABLE_NO_KEYWORD,\n\t\tstorepb.SQLReviewRule_NAMING_IDENTIFIER_NO_KEYWORD,\n\t\tstorepb.SQLReviewRule_STATEMENT_SELECT_NO_SELECT_ALL,\n\t\tstorepb.SQLReviewRule_STATEMENT_WHERE_REQUIRE_SELECT,\n\t\tstorepb.SQLReviewRule_STATEMENT_WHERE_REQUIRE_UPDATE_DELETE,\n\t\tstorepb.SQLReviewRule_STATEMENT_WHERE_NO_LEADING_WILDCARD_LIKE,\n\t\tstorepb.SQLReviewRule_STATEMENT_DISALLOW_ON_DEL_CASCADE,\n\t\tstorepb.SQLReviewRule_STATEMENT_DISALLOW_RM_TBL_CASCADE,\n\t\tstorepb.SQLReviewRule_STATEMENT_DISALLOW_TRUNCATE,\n\t\tstorepb.SQLReviewRule_STATEMENT_DISALLOW_COMMIT,","sourceCodeStart":429,"sourceCodeEnd":465,"githubUrl":"https://github.com/bytebase/bytebase/blob/1870550677fe08f0d2a78c07acd27541464eb945/backend/api/v1/review_config_service.go#L429-L465","documentation":"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.","triggerScenarios":"Saving a SQL review config containing SQL_REVIEW_RULE_NAMING_IDENTIFIER_CASE without naming_case_payload set, or with the wrong payload variant.","commonSituations":"Naming rule enabled in UI but casing options never configured; config generated from a template missing the payload; hand-edited JSON dropped the field.","solutions":["Provide naming_case_payload with the desired casing for each identifier kind","Remove the naming rule if identifier casing should not be enforced","Inspect the rule payload in the API response to confirm which field was omitted"],"exampleFix":"// before\n{\"type\": \"SQL_REVIEW_RULE_NAMING_IDENTIFIER_CASE\"}\n// after\n{\"type\": \"SQL_REVIEW_RULE_NAMING_IDENTIFIER_CASE\", \"namingCasePayload\": {\"table\": {\"format\": \"SNAKE_LOWER_CASE\"}}}","handlingStrategy":"validation","validationCode":"if (rule.type === 'SQL_REVIEW_RULE_NAMING_IDENTIFIER_CASE' && rule.namingCasePayload == null) {\n  throw new Error('NAMING_IDENTIFIER_CASE requires namingCasePayload');\n}","typeGuard":"function hasNamingCasePayload(r) {\n  return r.namingCasePayload != null && Object.keys(r.namingCasePayload).length > 0;\n}","tryCatchPattern":"try {\n  await reviewConfigService.UpdateReviewConfig(req);\n} catch (e) {\n  if (e.message.includes('requires naming case payload')) {\n    // configure identifier casing and resubmit\n  }\n  throw e;\n}","preventionTips":["Prompt for casing options whenever the naming rule is enabled","Keep rule type and payload construction in one code path","Snapshot-validate configs in CI before deployment"],"tags":["validation","sql-review","naming","payload"],"backgroundTag":"missing-required-config-field","analyzedSha":"1870550677fe08f0d2a78c07acd27541464eb945","analyzedAt":"2026-09-06T21:16:13.665Z","contentChangedAt":"2026-09-06T21:16:13.665Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}