glanceapp/glance · error

repository is required

Error message

repository is required

What it means

Thrown by the releases widget's custom YAML unmarshaling (UnmarshalYAML on releaseRequest) when neither the struct's repository field nor a bare string form of the widget entry provides a repository. The field is polymorphic: it accepts either 'owner/repo' shorthand or a mapping with repository:; if both decode to empty the entry has nothing to track.

Source

Thrown at internal/glance/widget-releases.go:127

	source releaseSource
	token  *string
}

func (r *releaseRequest) UnmarshalYAML(node *yaml.Node) error {
	type releaseRequestAlias releaseRequest
	alias := (*releaseRequestAlias)(r)
	var repository string

	if err := node.Decode(&repository); err != nil {
		if err := node.Decode(alias); err != nil {
			return fmt.Errorf("could not umarshal repository into string or struct: %v", err)
		}
	}

	if r.Repository == "" {
		if repository == "" {
			return errors.New("repository is required")
		} else {
			r.Repository = repository
		}
	}

	parts := strings.SplitN(repository, ":", 2)
	if len(parts) == 1 {
		r.source = releaseSourceGithub
	} else if len(parts) == 2 {
		r.Repository = parts[1]

		switch parts[0] {
		case string(releaseSourceGithub):
			r.source = releaseSourceGithub
		case string(releaseSourceGitlab):
			r.source = releaseSourceGitlab
		case string(releaseSourceDockerHub):
			r.source = releaseSourceDockerHub

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Give each entry a repository value: either '- owner/repo' shorthand or a mapping with repository: owner/repo
  2. Use the prefixed form 'gitlab:owner/repo', 'dockerhub:owner/repo', or 'codeberg:owner/repo' when the source is not GitHub
  3. Remove empty entries from the list

Example fix

# before
- type: releases
  repositories:
    - repository:

# after
- type: releases
  repositories:
    - go-glance/glance
Defensive patterns

Strategy: validation

Validate before calling

for r in w.get('repositories', []):
    repo = r if isinstance(r, str) else r.get('repository', '')
    if not repo:
        raise ValueError('every releases entry needs owner/repo (string or repository: key)')

Type guard

function isReleaseEntry(v: unknown): boolean {
  if (typeof v === 'string') return v.trim().length > 0;
  if (typeof v === 'object' && v !== null) {
    return typeof (v as any).repository === 'string' && (v as any).repository.length > 0;
  }
  return false;
}

Prevention

When it happens

Trigger: A releases widget whose repositories list contains an entry like '- repository:' (empty value) or an empty mapping '- {}'; a template/anchor that expands to an empty string; a misspelled key (repo:, name:) inside the mapping form.

Common situations: Listing repositories as mappings and omitting the repository key on one entry; commenting out a repository but leaving the list item; YAML anchors referencing an empty default.

Related errors


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