henrygd/beszel · warning
service name is required
Error message
service name is required
What it means
The systemd info handler decodes the request payload into common.SystemdInfoRequest via CBOR and requires ServiceName to be non-empty before querying systemd. This error is returned when the hub sent a SystemdInfo request whose ServiceName field is the empty string, i.e. a malformed or incomplete request.
Solutions
- Ensure the caller (hub UI or API client) always sets ServiceName before sending a SystemdInfoRequest.
- Update hub and agent to matching versions so the request schema (CBOR field names) lines up.
- If calling the agent programmatically, validate the request client-side and log the payload when ServiceName is empty.
Example fix
// before
req := common.SystemdInfoRequest{}
// after
req := common.SystemdInfoRequest{ServiceName: "beszel-hub.service"} Defensive patterns
Strategy: validation
Validate before calling
if req.ServiceName == "" {
return fmt.Errorf("cannot query systemd: ServiceName is empty")
} Try / catch
err := handle(hctx)
if err != nil && err.Error() == "service name is required" {
log.Warn("SystemdInfoRequest missing ServiceName — check hub payload", "data", hctx.Request.Data)
} Prevention
- Populate ServiceName from a real unit selection, never from an unset variable.
- Add client-side validation of SystemdInfoRequest before serialization.
- Keep hub/agent schemas in sync to avoid CBOR field drift.
When it happens
Trigger: Calling Handle with Action = systemd info while hctx.Request.Data unmarshals into common.SystemdInfoRequest with ServiceName == "" — e.g. hub UI/API submitted a service lookup without selecting a service, or sent an empty/zero-value payload.
Common situations: A hub bug or stale frontend sending an empty systemd service name; custom API calls to the agent's systemd endpoint omitting ServiceName; CBOR payloads decoded from older/newer request shapes where the field name shifted.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- failed to create new system
- failed to decode response
- failed to delete old systemd service records
- failed to encode request
- failed to marshal request
AI-assisted analysis of henrygd/beszel@b38fb7dafa (2026-08-31).
Data as JSON: /api/errors/a78bec9bb570891e.
Report an issue: GitHub.
Appendix: source
Thrown at agent/handlers.go:198
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// GetSystemdInfoHandler handles detailed systemd service info requests
type GetSystemdInfoHandler struct{}
func (h *GetSystemdInfoHandler) Handle(hctx *HandlerContext) error {
if hctx.Agent.systemdManager == nil {
return errors.ErrUnsupported
}
var req common.SystemdInfoRequest
if err := cbor.Unmarshal(hctx.Request.Data, &req); err != nil {
return err
}
if req.ServiceName == "" {
return errors.New("service name is required")
}
details, err := hctx.Agent.systemdManager.getServiceDetails(req.ServiceName)
if err != nil {
return err
}
return hctx.SendResponse(details, hctx.RequestID)
}
View on GitHub (pinned to b38fb7dafa)