yudai/gotty · error

failed to create backend

Error message

failed to create backend

What it means

Wrapped error from factory.New in processWSConn: the configured backend (slave) refused or failed to initialize with the parsed query params — for the local command factory this covers exec failures such as command-not-found or permission denied. This is the generic boundary guarding all backend constructors.

Source

Thrown at server/handlers.go:121

	}
	if init.AuthToken != server.options.Credential {
		return errors.New("failed to authenticate websocket connection")
	}

	queryPath := "?"
	if server.options.PermitArguments && init.Arguments != "" {
		queryPath = init.Arguments
	}

	query, err := url.Parse(queryPath)
	if err != nil {
		return errors.Wrapf(err, "failed to parse arguments")
	}
	params := query.Query()
	var slave Slave
	slave, err = server.factory.New(params)
	if err != nil {
		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")

View on GitHub (pinned to a080c85cbc)

Solutions

  1. Check that the configured command exists in PATH and is executable (local backend)
  2. Validate factory-specific params derived from the query string before calling New
  3. Surface the wrapped backend error in logs so operators can see the real cause
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at server/handlers.go:121 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/7a9871c58bbc6604. Report an issue: GitHub.