henrygd/beszel · error

unsupported action: %d

Error message

unsupported action: %d

What it means

unmarshalLegacyResponse only knows how to decode legacy typed fields for GetData, CheckFingerprint, GetContainerLogs, GetContainerInfo, GetSmartData, and GetSystemdInfo. Any other action code reaching the legacy path is rejected with this error.

Source

Thrown at internal/hub/transport/transport.go:119

			}
			d.Data = resp.SmartData
			d.Complete = resp.SmartComplete
			return nil
		default:
			return fmt.Errorf("unexpected dest type for GetSmartData: %T", dest)
		}
	case common.GetSystemdInfo:
		d, ok := dest.(*systemd.ServiceDetails)
		if !ok {
			return fmt.Errorf("unexpected dest type for GetSystemdInfo: %T", dest)
		}
		if resp.ServiceInfo == nil {
			return errors.New("no systemd info in response")
		}
		*d = resp.ServiceInfo
		return nil
	}
	return fmt.Errorf("unsupported action: %d", action)
}

View on GitHub (pinned to b38fb7dafa)

Solutions

  1. Verify the action is one of the supported common.WebSocketAction values
  2. Upgrade hub and agent together to 0.19+ so responses use the generic CBOR Data path, bypassing the legacy switch
  3. Check for version skew: an old agent (0.18.0) returning legacy responses cannot serve new actions

Example fix

// before
var res systemd.ServiceDetails
err := t.Request(ctx, common.GetLogsPlus, req, &res) // action unsupported in legacy path
// after
var res systemd.ServiceDetails
err := t.Request(ctx, common.GetSystemdInfo, req, &res)
Defensive patterns

Strategy: validation

Validate before calling

var supported = map[common.WebSocketAction]bool{
    common.GetData: true, common.CheckFingerprint: true, common.GetContainerLogs: true,
    common.GetContainerInfo: true, common.GetSmartData: true, common.GetSystemdInfo: true,
}
if !supported[action] {
    return fmt.Errorf("action %d not supported for legacy responses", action)
}

Try / catch

if err := t.Request(ctx, action, req, dest); err != nil {
    if strings.Contains(err.Error(), "unsupported action") { /* upgrade agent or change action */ }
    return err
}

Prevention

When it happens

Trigger: Calling Transport.Request/UnmarshalResponse with an action value not in the legacy switch (e.g. a newer action added after 0.18.0) while the response has an empty Data field, or passing a zero/invalid action value.

Common situations: Requesting a newer action (introduced post-0.18) against a hub/agent pairing where the generic Data path is not taken; enum drift between hub and agent versions; passing an uninitialized action constant.

Related errors


AI-assisted analysis of henrygd/beszel@b38fb7dafa (2026-08-31). Data as JSON: /api/errors/91889816effcef8a. Report an issue: GitHub.