semaphoreui/semaphore · error

access key type not supported for ansible user

Error message

access key type not supported for ansible user

What it means

Returned by KeyInstaller.Install in pkg/ssh/agent.go when the access key used for the Ansible user role falls outside the supported types (SSH key, login/password, and the remaining handled case in that switch). Hitting the default/error branch of the switch over key.Type means the credential kind attached to the task cannot be installed for connecting to the target hosts — e.g. an unsupported or newly added key type was selected for the ansible user role.

Solutions

  1. Switch the environment's ansible-user access key to one of the supported types (SSH key or login/password)
  2. If a new key type was introduced in db.AccessKey, extend this switch in KeyInstaller.Install with an installation path for it
  3. Validate allowed key types per role when the environment is saved, not at task run time
Defensive patterns

Strategy: type-guard

When it happens

Trigger: Thrown at pkg/ssh/agent.go:231 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of semaphoreui/semaphore@1774ccb71a (2026-09-07). Data as JSON: /api/errors/0cb562eaf34b0458. Report an issue: GitHub.

Appendix: source

Thrown at pkg/ssh/agent.go:231

		if key.Type != db.AccessKeyLoginPassword {
			err = fmt.Errorf("access key type not supported for ansible become user")
		}
		installation.Login = key.LoginPassword.Login
		installation.Password = key.LoginPassword.Password
	case db.AccessKeyRoleAnsibleUser:
		switch key.Type {
		case db.AccessKeySSH:
			var agent Agent
			agent, err = StartSSHAgent(key, logger)
			installation.SSHAgent = &agent
			installation.Login = key.SshKey.Login
		case db.AccessKeyLoginPassword:
			installation.Login = key.LoginPassword.Login
			installation.Password = key.LoginPassword.Password
		case db.AccessKeyNone:
			// No SSH agent or password needed for ansible user with no access key.
		default:
			err = fmt.Errorf("access key type not supported for ansible user")
		}
	}

	return
}

View on GitHub (pinned to 1774ccb71a)