glanceapp/glance · error

column %d of page %d: size can only be either small or full

Error message

column %d of page %d: size can only be either small or full

What it means

Every column must have size either small or full; the column at the given position (1-indexed, within the given page) has any other value. Empty size also fails here, so size is effectively required per column.

Source

Thrown at internal/glance/config.go:523

		}

		if page.Width == "slim" {
			if len(page.Columns) > 2 {
				return fmt.Errorf("page %d is slim and cannot have more than 2 columns", i+1)
			}
		} else {
			if len(page.Columns) > 3 {
				return fmt.Errorf("page %d has more than 3 columns", i+1)
			}
		}

		columnSizesCount := make(map[string]int)

		for j := range page.Columns {
			column := &page.Columns[j]

			if column.Size != "small" && column.Size != "full" {
				return fmt.Errorf("column %d of page %d: size can only be either small or full", j+1, i+1)
			}

			columnSizesCount[page.Columns[j].Size]++
		}

		full := columnSizesCount["full"]

		if full > 2 || full == 0 {
			return fmt.Errorf("page %d must have either 1 or 2 full width columns", i+1)
		}
	}

	return nil
}

// Read-only way to store ordered maps from a YAML structure
type orderedYAMLMap[K comparable, V any] struct {
	keys []K

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Set the column's size to small or full explicitly
  2. Check the column number in the message to find the offending entry fast
  3. Remember there is no default — every column needs an explicit size

Example fix

# before
columns:
  - widgets:
      - type: clock
# after
columns:
  - size: full
    widgets:
      - type: clock
Defensive patterns

Strategy: type-guard

Validate before calling

for i, p := range cfg.Pages {
    for j, c := range p.Columns {
        if c.Size != "small" && c.Size != "full" {
            return fmt.Errorf("page %d column %d bad size %q", i+1, j+1, c.Size)
        }
    }
}

Type guard

func isValidColumnSize(s string) bool {
    return s == "small" || s == "full"
}

Prevention

When it happens

Trigger: pages[N].columns[j].size set to something like 'medium', 'half', or omitted entirely (decodes to empty string, which is neither small nor full).

Common situations: Assuming a default size exists and omitting the field; guessing undocumented sizes like 'half'; capitalization differences ('Full').

Related errors


AI-assisted analysis of glanceapp/glance@91324e8de7 (2026-08-15). Data as JSON: /api/errors/59ce18185d059d92. Report an issue: GitHub.