gastownhall/beads · error

table name too long

Error message

table name too long

What it means

validateTableName enforces the same 64-character identifier limit as database names, matching MySQL/Dolt identifier limits. Table names are interpolated into backtick-quoted SQL, and the server would reject anything longer, so the library fails fast with a clear message.

Source

Thrown at internal/storage/dolt/history.go:48

	if name == "" {
		return fmt.Errorf("database name cannot be empty")
	}
	if len(name) > 64 {
		return fmt.Errorf("database name too long")
	}
	if !validDatabasePattern.MatchString(name) {
		return fmt.Errorf("invalid database name: %s", name)
	}
	return nil
}

// validateTableName checks if a table name is safe to use in queries
func validateTableName(table string) error {
	if table == "" {
		return fmt.Errorf("table name cannot be empty")
	}
	if len(table) > 64 {
		return fmt.Errorf("table name too long")
	}
	if !validTablePattern.MatchString(table) {
		return fmt.Errorf("invalid table name: %s", table)
	}
	return nil
}

// issueHistory represents an issue at a specific point in history
type issueHistory struct {
	Issue      *types.Issue
	CommitHash string
	Committer  string
	CommitDate time.Time
}

// getIssueHistory returns the complete history of an issue
func (s *DoltStore) getIssueHistory(ctx context.Context, issueID string) ([]*issueHistory, error) {
	// Wrap in a subquery to avoid Dolt's max1Row optimization on PK lookup.

View on GitHub (pinned to 71377f2769)

Solutions

  1. Shorten the table name to 64 bytes or fewer before querying.
  2. If deriving history/table names dynamically, truncate the base identifier so the composed name (including any 'dolt_history_' prefix budget) stays within 64 bytes.
  3. Review code that concatenates prefixes/suffixes onto table names and add a length check at the composition point.

Example fix

// before
table := "issues_" + strings.Repeat("x", 80)
validateTableName(table) // fails
// after
table := "issues_" + hash[:12] // keep total length <= 64
validateTableName(table)
Defensive patterns

Strategy: validation

Validate before calling

func validTableName(t string) bool { return len(t) > 0 && len(t) <= 64 }
if !validTableName(table) { return fmt.Errorf("table name %q must be 1-64 chars", table) }

Type guard

func isShortIdentifier(s string) bool { return len(s) <= 64 }

Prevention

When it happens

Trigger: Passing a table name longer than 64 bytes into any internal query path that validates via validateTableName (e.g. history queries against dolt_history_<table> or conflict queries).

Common situations: Programmatically generated table names combining long prefixes and suffixes (e.g. 'dolt_history_' + a long name exceeding 64 bytes); tenant-prefixed table schemes; name collisions with schema-migration limits.

Related errors


AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30). Data as JSON: /api/errors/978dc9dc6fc99010. Report an issue: GitHub.