henrygd/beszel · error
unexpected dest type for GetSystemdInfo: %T
Error message
unexpected dest type for GetSystemdInfo: %T
What it means
For legacy (0.18.0) responses with empty generic Data, unmarshalLegacyResponse copies resp.ServiceInfo into dest, which must be exactly *systemd.ServiceDetails. This error means dest was a different type, so the type assertion failed.
Source
Thrown at internal/hub/transport/transport.go:111
if resp.SmartData == nil {
return errors.New("no SMART data in response")
}
*d = resp.SmartData
return nil
case *smart.SmartDataResponse:
if resp.SmartData == nil {
return errors.New("no SMART data in response")
}
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
- Pass *systemd.ServiceDetails as dest for GetSystemdInfo requests
- Ensure you are not accidentally passing **systemd.ServiceDetails or the value type systemd.ServiceDetails
- Upgrade agents to 0.19+ so the generic Data path is used instead of the legacy switch
Example fix
// before var info systemd.ServiceList err := t.Request(ctx, common.GetSystemdInfo, nil, &info) // after var info systemd.ServiceDetails err := t.Request(ctx, common.GetSystemdInfo, nil, &info)
Defensive patterns
Strategy: type-guard
Validate before calling
if _, ok := dest.(*systemd.ServiceDetails); !ok {
return fmt.Errorf("GetSystemdInfo dest must be *systemd.ServiceDetails, got %T", dest)
} Type guard
func isSystemdDest(dest any) bool {
_, ok := dest.(*systemd.ServiceDetails)
return ok
} Try / catch
if err := t.Request(ctx, common.GetSystemdInfo, nil, &details); err != nil {
if strings.Contains(err.Error(), "unexpected dest type") { /* correct the dest type */ }
return err
} Prevention
- Pass exactly *systemd.ServiceDetails (not value or double pointer) for GetSystemdInfo
- Match dest type to the action constant as documented in transport.go
- Prefer the generic 0.19+ path where any dest works
When it happens
Trigger: Calling Transport.Request/UnmarshalResponse with action common.GetSystemdInfo and a dest that is not *systemd.ServiceDetails, when the agent response carries no generic CBOR Data field.
Common situations: Passing a wrapper struct or value (non-pointer) type instead of *systemd.ServiceDetails; code written against the 0.19+ generic path running against an older agent.
Related errors
- unexpected dest type for GetSmartData: %T
- service name is required
- systemd manager unavailable
- unexpected dest type for GetData: %T
- unexpected dest type for CheckFingerprint: %T
AI-assisted analysis of henrygd/beszel@b38fb7dafa (2026-08-31).
Data as JSON: /api/errors/b63a97b6cc8a1076.
Report an issue: GitHub.