hashicorp/nomad · error

%s does not meet systemd conventions

Error message

%s does not meet systemd conventions

What it means

Generic validation error from ScanServiceName in the monitor export endpoint: after checking the systemd unit-type suffix, the remaining unit-name prefix fails the systemd naming regex (^\w[\w._-]*(@[\w._-]+)?$), so the service name is not a valid systemd unit name.

Source

Thrown at command/agent/monitor/export_monitor.go:163

			"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"
	if opts.LogsSince != "" {
		parsedDur, err := time.ParseDuration(opts.LogsSince)
		if err != nil {
			return nil, err
		}
		cmdDuration = parsedDur.String()
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Use a service name with only alphanumerics, underscores, periods, and hyphens before the optional @instance part
  2. Drop unsupported characters (spaces, slashes, shell metacharacters) from the unit prefix
  3. Verify the name follows systemd unit naming conventions, e.g. nginx.service or foo@1.service
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at command/agent/monitor/export_monitor.go:163 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/881e70f496fa67c7. Report an issue: GitHub.