semaphoreui/semaphore · error
value of field ' ' is not valid: (Must match regex: ' ')
Error message
value of field '%v' is not valid: %v (Must match regex: '%v')
What it means
validate() returns this error when a config struct field tagged with `rule:"<regex>"` does not match that regular expression. The message shows the field name, its (masked) value, and the required regex. It is Semaphore's built-in config validation run at startup/after config changes.
Solutions
- Compare the shown value against the regex in the message and correct the value in config/config.env or the UI
- Trim whitespace and stray quotes from the value
- Check the `rule:` tag on the field in util/config.go for the exact requirement
- After an upgrade, review changed rule tags for fields you set
Example fix
// before EMAIL_SENDER=not-an-email // after EMAIL_SENDER=admin@example.com
Defensive patterns
Strategy: validation
Validate before calling
var emailRe = regexp.MustCompile(`^[^@\s]+@[^@\s]+\.[^@\s]+$`)
if v := os.Getenv("EMAIL_SENDER"); v != "" && !emailRe.MatchString(v) {
return fmt.Errorf("EMAIL_SENDER %q will be rejected: must look like an email", v)
} Type guard
func matchesRule(value string, rule string) bool {
ok, _ := regexp.MatchString(rule, value)
return ok
} Try / catch
if err := util.ConfigValidate(tmpConfig); err != nil {
return fmt.Errorf("config invalid, aborting start: %w", err)
} Prevention
- Read the `rule:` tag on each configured field to learn the accepted format
- Trim whitespace/quotes from values sourced from env files and shell
- Run config validation (util.ConfigValidate) in CI or before restarts
- After upgrades, review newly added rule tags against your existing values
When it happens
Trigger: Setting a config field to a value violating its rule tag, e.g. an email that does not match the required pattern, a bad URL in an endpoint field, or an empty string where a non-empty pattern is required.
Common situations: Email/URL fields with typos; trailing spaces or quotes copied from docs; legacy values that fail newly added rule tags after upgrade; empty values for required fields.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- : 'value' and 'file' are mutually exclusive
- : read key file
- encryption_keys.active.%s_key: no key labelled
- encryption_keys.active.%s_key_file
- encryption_keys.keys_folder
AI-assisted analysis of semaphoreui/semaphore@1774ccb71a (2026-09-07).
Data as JSON: /api/errors/e16d7a9d67284f22.
Report an issue: GitHub.
Appendix: source
Thrown at util/config.go:1430
} else if fieldType.Type.Kind() == reflect.Uint {
strVal = strconv.FormatUint(fieldValue.Uint(), 10)
} else {
strVal = fieldValue.String()
}
match, _ := regexp.MatchString(rule, strVal)
if match {
continue
}
fieldName := strings.ToLower(fieldType.Name)
if strings.Contains(fieldName, "password") || strings.Contains(fieldName, "secret") || strings.Contains(fieldName, "key") {
strVal = "***"
}
return fmt.Errorf(
"value of field '%v' is not valid: %v (Must match regex: '%v')",
fieldType.Name, strVal, rule,
)
}
return nil
}
// resolveKeySource returns the key material from a KeySource: the inline Value,
// or the trimmed contents of File. Value and File are mutually exclusive.
func resolveKeySource(ks KeySource, name string) (string, error) {
if ks.Value != "" && ks.File != "" {
return "", fmt.Errorf("%s: 'value' and 'file' are mutually exclusive", name)
}
if ks.File != "" {
data, err := os.ReadFile(ks.File)
if err != nil {
return "", fmt.Errorf("%s: read key file %q: %w", name, ks.File, err)View on GitHub (pinned to 1774ccb71a)