wavetermdev/waveterm · info

user selected no

Error message

user selected no

What it means

createUnknownKeyVerifier builds a confirmation closure for a host whose key exists in no known_hosts file. When GetUserInput returns a response with Confirm == false, the closure fails with 'user selected no', aborting the host-key trust flow. The connection attempt is then cancelled instead of writing the key to known_hosts.

Source

Thrown at pkg/remote/sshclient.go:541

			"%s.\n\n"+
			"**Would you like to continue connecting?** If so, the key will be permanently "+
			"added to the file %s "+
			"to protect from future man-in-the-middle attacks.", hostname, remote, key.Type(), base64Key, knownHostsFile)
	request := &userinput.UserInputRequest{
		ResponseType: "confirm",
		QueryText:    queryText,
		Markdown:     true,
		Title:        "Known Hosts Key Missing",
	}
	return func() (*userinput.UserInputResponse, error) {
		ctx, cancelFn := context.WithTimeout(ctx, 60*time.Second)
		defer cancelFn()
		resp, err := userinput.GetUserInput(ctx, request)
		if err != nil {
			return nil, err
		}
		if !resp.Confirm {
			return nil, fmt.Errorf("user selected no")
		}
		return resp, nil
	}
}

func createMissingKnownHostsVerifier(knownHostsFile string, hostname string, remote string, key ssh.PublicKey) func() (*userinput.UserInputResponse, error) {
	base64Key := base64.StdEncoding.EncodeToString(key.Marshal())
	queryText := fmt.Sprintf(
		"The authenticity of host '%s (%s)' can't be established "+
			"as **no known_hosts files could be found**. "+
			"The host you are attempting to connect to provides this %s key:  \n"+
			"%s.\n\n"+
			"**Would you like to continue connecting?** If so:  \n"+
			"- %s will be created  \n"+
			"- the key will be added to %s\n\n"+
			"This will protect from future man-in-the-middle attacks.", hostname, remote, key.Type(), base64Key, knownHostsFile, knownHostsFile)
	request := &userinput.UserInputRequest{
		ResponseType: "confirm",

View on GitHub (pinned to a4447c1563)

Solutions

  1. Reconnect and confirm the prompt with Yes to add the key to known_hosts.
  2. Pre-seed the key via ssh-keyscan into the known_hosts file the app uses.
  3. For non-interactive use, arrange an input provider that programmatically confirms, or pre-trust the host key.

Example fix

// before
// no known_hosts entry, user clicks No
// after
$ ssh-keyscan -H hostname >> ~/.ssh/known_hosts  # then reconnect
Defensive patterns

Strategy: try-catch

Validate before calling

// check if the host is already trusted
if !hostInKnownHosts(hostname, knownHostsFile) {
    // expect a confirmation prompt; ensure a user or policy can answer Yes
}

Try / catch

if err := Connect(...); err != nil {
    if strings.Contains(err.Error(), "user selected no") {
        // prompt was declined; show guidance to accept or pre-trust the key
    }
}

Prevention

When it happens

Trigger: First connection to a host not present in any configured known_hosts file, and the user dismisses/rejects the 'The authenticity of host ... can't be established' confirmation dialog within the 60-second prompt timeout window.

Common situations: New server provisioned and connected for the first time; headless/CI runs where the input UI auto-declines or times out; user noticing a key mismatch concern and declining.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/1f8e23ef7f04f185. Report an issue: GitHub.