lima-vm/lima · error

unknown tunnel type: %#q

Error message

unknown tunnel type: %#q

What it means

Error returned by `limactl tunnel` (tunnelAction in cmd/limactl/tunnel.go:58) when the `--type` flag is set to anything other than "socks". Only the SOCKS5 tunnel type is currently implemented (other types such as l2tp/ikev2/masque are TODO). Passing e.g. `--type l2tp` produces `unknown tunnel type: "l2tp"`. Fix by using `--type socks` (the default) or omitting the flag.

Source

Thrown at cmd/limactl/tunnel.go:58

		GroupID:           advancedCommand,
	}

	tunnelCmd.Flags().SetInterspersed(false)
	// TODO: implement l2tp, ikev2, masque, ...
	tunnelCmd.Flags().String("type", "socks", "Tunnel type, currently only \"socks\" is implemented")
	tunnelCmd.Flags().Int("socks-port", 0, "SOCKS port, defaults to a random port")
	return tunnelCmd
}

func tunnelAction(cmd *cobra.Command, args []string) error {
	ctx := cmd.Context()
	flags := cmd.Flags()
	tunnelType, err := flags.GetString("type")
	if err != nil {
		return err
	}
	if tunnelType != "socks" {
		return fmt.Errorf("unknown tunnel type: %#q", tunnelType)
	}
	port, err := flags.GetInt("socks-port")
	if err != nil {
		return err
	}
	if port != 0 && (port < 1024 || port > 65535) {
		return fmt.Errorf("invalid socks port %d", port)
	}
	stdout, stderr := cmd.OutOrStdout(), cmd.ErrOrStderr()
	instName := args[0]
	inst, err := store.Inspect(ctx, instName)
	if err != nil {
		if errors.Is(err, os.ErrNotExist) {
			return fmt.Errorf("instance %#q does not exist, run `limactl create %s` to create a new instance", instName, instName)
		}
		return err
	}
	if inst.Status == limatype.StatusStopped {

View on GitHub (pinned to dd909d0973)

Solutions

  1. Use `--type socks` (the only supported value)
  2. Omit `--type` — it defaults to socks
  3. If a different transport is needed, use SSH port forwarding directly instead of `limactl tunnel`
  4. Check `limactl tunnel --help` for supported values

Example fix

// before
limactl tunnel --type ssh instance
// after
limactl tunnel --type socks instance
Defensive patterns

Strategy: validation

Validate before calling

if t := cmd.Flags().Lookup("type"); t != nil && t.Value.String() != "socks" {
	return fmt.Errorf("only --type socks is supported, got %q", t.Value.String())
}

Prevention

When it happens

Trigger: Running `limactl tunnel --type <value> ...` with any value other than `socks` (e.g. `ssh`, `http`, `tcp`, or a typo like `sock`).

Common situations: Assuming other tunnel protocols are supported because the flag exists; copying a command from docs for a different tool; typos in the flag value.

Related errors


AI-assisted analysis of lima-vm/lima@dd909d0973 (2026-09-01). Data as JSON: /api/errors/e9e8eb63457bec25. Report an issue: GitHub.