glanceapp/glance · error

source is required

Error message

source is required

What it means

Thrown by the iframe widget's initialize() when the source field is empty. The widget renders a single <iframe src=...>, so source is the only required field; it is parsed with url.Parse (which almost never fails) and the height defaults to 300 when left at 50 or clamped to a minimum of 50.

Source

Thrown at internal/glance/widget-iframe.go:23

	"fmt"
	"html/template"
	"net/url"
)

var iframeWidgetTemplate = mustParseTemplate("iframe.html", "widget-base.html")

type iframeWidget struct {
	widgetBase `yaml:",inline"`
	cachedHTML template.HTML `yaml:"-"`
	Source     string        `yaml:"source"`
	Height     int           `yaml:"height"`
}

func (widget *iframeWidget) initialize() error {
	widget.withTitle("IFrame").withError(nil)

	if widget.Source == "" {
		return errors.New("source is required")
	}

	if _, err := url.Parse(widget.Source); err != nil {
		return fmt.Errorf("parsing URL: %v", err)
	}

	if widget.Height == 50 {
		widget.Height = 300
	} else if widget.Height < 50 {
		widget.Height = 50
	}

	widget.cachedHTML = widget.renderTemplate(widget, iframeWidgetTemplate)

	return nil
}

func (widget *iframeWidget) Render() template.HTML {

View on GitHub (pinned to 91324e8de7)

Solutions

  1. Set source: to the URL to embed, e.g. source: https://example.com/embed
  2. Check the key is exactly 'source' and correctly indented at widget level
  3. Optionally set height: (values below 50 clamp to 50; unset defaults to 300)

Example fix

# before
- type: iframe
  height: 400

# after
- type: iframe
  source: https://example.com/embed
  height: 400
Defensive patterns

Strategy: validation

Validate before calling

if w['type'] == 'iframe' and not w.get('source'):
    raise ValueError('iframe widget requires source')

Prevention

When it happens

Trigger: A widget of type: iframe with no source: key, source commented out, or misspelled (src:, url:); a source value that YAML parses as null.

Common situations: Embedding an internal tool and removing the source while iterating; indentation errors nesting source under another key.

Related errors


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