{"record":{"id":"b63a97b6cc8a1076","repo":"henrygd/beszel","slug":"unexpected-dest-type-for-getsystemdinfo-t","errorCode":null,"errorMessage":"unexpected dest type for GetSystemdInfo: %T","messagePattern":"unexpected dest type for GetSystemdInfo: %T","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/hub/transport/transport.go","lineNumber":111,"sourceCode":"\t\t\tif resp.SmartData == nil {\n\t\t\t\treturn errors.New(\"no SMART data in response\")\n\t\t\t}\n\t\t\t*d = resp.SmartData\n\t\t\treturn nil\n\t\tcase *smart.SmartDataResponse:\n\t\t\tif resp.SmartData == nil {\n\t\t\t\treturn errors.New(\"no SMART data in response\")\n\t\t\t}\n\t\t\td.Data = resp.SmartData\n\t\t\td.Complete = resp.SmartComplete\n\t\t\treturn nil\n\t\tdefault:\n\t\t\treturn fmt.Errorf(\"unexpected dest type for GetSmartData: %T\", dest)\n\t\t}\n\tcase common.GetSystemdInfo:\n\t\td, ok := dest.(*systemd.ServiceDetails)\n\t\tif !ok {\n\t\t\treturn fmt.Errorf(\"unexpected dest type for GetSystemdInfo: %T\", dest)\n\t\t}\n\t\tif resp.ServiceInfo == nil {\n\t\t\treturn errors.New(\"no systemd info in response\")\n\t\t}\n\t\t*d = resp.ServiceInfo\n\t\treturn nil\n\t}\n\treturn fmt.Errorf(\"unsupported action: %d\", action)\n}\n","sourceCodeStart":93,"sourceCodeEnd":121,"githubUrl":"https://github.com/henrygd/beszel/blob/b38fb7dafa60812cc22e6a84ce313e94f1ce0a32/internal/hub/transport/transport.go#L93-L121","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nvar info systemd.ServiceList\nerr := t.Request(ctx, common.GetSystemdInfo, nil, &info)\n// after\nvar info systemd.ServiceDetails\nerr := t.Request(ctx, common.GetSystemdInfo, nil, &info)","handlingStrategy":"type-guard","validationCode":"if _, ok := dest.(*systemd.ServiceDetails); !ok {\n    return fmt.Errorf(\"GetSystemdInfo dest must be *systemd.ServiceDetails, got %T\", dest)\n}","typeGuard":"func isSystemdDest(dest any) bool {\n    _, ok := dest.(*systemd.ServiceDetails)\n    return ok\n}","tryCatchPattern":"if err := t.Request(ctx, common.GetSystemdInfo, nil, &details); err != nil {\n    if strings.Contains(err.Error(), \"unexpected dest type\") { /* correct the dest type */ }\n    return err\n}","preventionTips":["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"],"tags":["type-mismatch","legacy-response","systemd"],"backgroundTag":"unexpected-destination-type","analyzedSha":"b38fb7dafa60812cc22e6a84ce313e94f1ce0a32","analyzedAt":"2026-08-31T15:10:10.149Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}