yudai/gotty · error

failed to fill window title template

Error message

failed to fill window title template

What it means

Wrapped template.Execute error while rendering the window title with noesctmpl: the server's TitleFormat string (or a value in the title variables, e.g. a nil from slave.WindowTitleVariables) cannot be executed against the collected template data. This is a server-side configuration/template mismatch, independent of the client.

Source

Thrown at server/handlers.go:139

		return errors.Wrapf(err, "failed to create backend")
	}
	defer slave.Close()

	titleVars := server.titleVariables(
		[]string{"server", "master", "slave"},
		map[string]map[string]interface{}{
			"server": server.options.TitleVariables,
			"master": map[string]interface{}{
				"remote_addr": conn.RemoteAddr(),
			},
			"slave": slave.WindowTitleVariables(),
		},
	)

	titleBuf := new(bytes.Buffer)
	err = server.titleTemplate.Execute(titleBuf, titleVars)
	if err != nil {
		return errors.Wrapf(err, "failed to fill window title template")
	}

	opts := []webtty.Option{
		webtty.WithWindowTitle(titleBuf.Bytes()),
	}
	if server.options.PermitWrite {
		opts = append(opts, webtty.WithPermitWrite())
	}
	if server.options.EnableReconnect {
		opts = append(opts, webtty.WithReconnect(server.options.ReconnectTime))
	}
	if server.options.Width > 0 {
		opts = append(opts, webtty.WithFixedColumns(server.options.Width))
	}
	if server.options.Height > 0 {
		opts = append(opts, webtty.WithFixedRows(server.options.Height))
	}
	if server.options.Preferences != nil {

View on GitHub (pinned to a080c85cbc)

Solutions

  1. Test-render the --title-format string at startup and fail fast on invalid templates
  2. Ensure slave backends always return non-nil WindowTitleVariables maps
  3. Fall back to a static default title instead of killing the connection
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at server/handlers.go:139 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of yudai/gotty@a080c85cbc (2026-09-02). Data as JSON: /api/errors/deda51cff018250f. Report an issue: GitHub.