hashicorp/nomad · error
invalid suffix
Error message
invalid suffix
What it means
ScanServiceName splits the input on '.'; when a suffix exists, it must be one of the valid systemd unit types (service, path, timer, slice, scope, etc.) checked via slices.Contains. If the suffix is not in that list, the function returns this error. This guards against unsupported or malformed systemd unit suffixes being passed to journald export.
Source
Thrown at command/agent/monitor/export_monitor.go:156
if len(splitInput) < 2 {
prefix = input
} else {
suffix := splitInput[len(splitInput)-1]
validSuffix := []string{
"service",
"socket",
"device",
"mount",
"automount",
"swap",
"target",
"path",
"timer",
"slice",
"scope",
}
if valid := slices.Contains(validSuffix, suffix); !valid {
return errors.New("invalid suffix")
}
prefix = strings.Join(splitInput[:len(splitInput)-1], "")
}
safe, _ := regexp.MatchString(`^[\w\\._-]*(@[\w\\._-]+)?$`, prefix)
if !safe {
return fmt.Errorf("%s does not meet systemd conventions", prefix)
}
return nil
}
func cliReader(opts MonitorExportOpts) (*ExportReader, error) {
isCli := true
// Vet servicename again
if err := ScanServiceName(opts.ServiceName); err != nil {
return nil, err
}
cmdDuration := "72 hours"View on GitHub (pinned to 482b49bf1a)
Solutions
- Use a valid systemd suffix: `.service`, `.path`, `.timer`, `.slice`, `.scope` (or others in Nomad's validSuffix list), e.g. `nomad-client.service`.
- Remove file extensions or extra dots from the configured name.
- Check the exact unit name with `systemctl status <name>` and pass the canonical unit name.
- If monitoring a unit type Nomad rejects, monitor it directly with journalctl instead.
Example fix
// before
ScanServiceName("nomad-client.servcie")
// after
ScanServiceName("nomad-client.service") Defensive patterns
Strategy: validation
Validate before calling
var validSuffix = map[string]bool{"service": true, "path": true, "timer": true, "slice": true, "scope": true}
parts := strings.Split(serviceName, ".")
if len(parts) >= 2 && !validSuffix[parts[len(parts)-1]] {
return fmt.Errorf("unsupported systemd suffix .%s", parts[len(parts)-1])
} Try / catch
if err := monitor.ScanServiceName(name); err != nil {
if strings.Contains(err.Error(), "invalid suffix") {
return fmt.Errorf("use a valid systemd unit suffix (.service, .timer, ...) for %q", name)
}
return err
} Prevention
- Use canonical unit names from `systemctl status`, not file names with stray extensions.
- Strip backup extensions like .bak before submitting names.
- Restrict monitoring config to .service units Nomad manages.
When it happens
Trigger: Passing a unit name whose dot-suffix is not a recognized systemd unit type — e.g. `nomad-job.conf`, `nomad.service.bak`, `nomad.foo` — to AgentMonitorExport or the CLI reader.
Common situations: Typos in suffix (`.servcie`), passing file names instead of unit names, extra dots creating an unexpected last segment, or users specifying socket/mount units that are not in Nomad's valid list.
Related errors
- service name too long
- service name must include 'nomad
- Missing task name
- Task cannot be named "alloc"
- Task name cannot include slashes
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/6507590cd4ab2be2.
Report an issue: GitHub.