{"record":{"id":"e16d7a9d67284f22","repo":"semaphoreui/semaphore","slug":"value-of-field-v-is-not-valid-v-must-match-r","errorCode":null,"errorMessage":"value of field '%v' is not valid: %v (Must match regex: '%v')","messagePattern":"value of field '(.+?)' is not valid: (.+?) \\(Must match regex: '(.+?)'\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"util/config.go","lineNumber":1430,"sourceCode":"\t\t} else if fieldType.Type.Kind() == reflect.Uint {\n\t\t\tstrVal = strconv.FormatUint(fieldValue.Uint(), 10)\n\t\t} else {\n\t\t\tstrVal = fieldValue.String()\n\t\t}\n\n\t\tmatch, _ := regexp.MatchString(rule, strVal)\n\n\t\tif match {\n\t\t\tcontinue\n\t\t}\n\n\t\tfieldName := strings.ToLower(fieldType.Name)\n\n\t\tif strings.Contains(fieldName, \"password\") || strings.Contains(fieldName, \"secret\") || strings.Contains(fieldName, \"key\") {\n\t\t\tstrVal = \"***\"\n\t\t}\n\n\t\treturn fmt.Errorf(\n\t\t\t\"value of field '%v' is not valid: %v (Must match regex: '%v')\",\n\t\t\tfieldType.Name, strVal, rule,\n\t\t)\n\t}\n\n\treturn nil\n}\n\n// resolveKeySource returns the key material from a KeySource: the inline Value,\n// or the trimmed contents of File. Value and File are mutually exclusive.\nfunc resolveKeySource(ks KeySource, name string) (string, error) {\n\tif ks.Value != \"\" && ks.File != \"\" {\n\t\treturn \"\", fmt.Errorf(\"%s: 'value' and 'file' are mutually exclusive\", name)\n\t}\n\tif ks.File != \"\" {\n\t\tdata, err := os.ReadFile(ks.File)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"%s: read key file %q: %w\", name, ks.File, err)","sourceCodeStart":1412,"sourceCodeEnd":1448,"githubUrl":"https://github.com/semaphoreui/semaphore/blob/1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa/util/config.go#L1412-L1448","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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"],"exampleFix":"// before\nEMAIL_SENDER=not-an-email\n// after\nEMAIL_SENDER=admin@example.com","handlingStrategy":"validation","validationCode":"var emailRe = regexp.MustCompile(`^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$`)\nif v := os.Getenv(\"EMAIL_SENDER\"); v != \"\" && !emailRe.MatchString(v) {\n    return fmt.Errorf(\"EMAIL_SENDER %q will be rejected: must look like an email\", v)\n}","typeGuard":"func matchesRule(value string, rule string) bool {\n    ok, _ := regexp.MatchString(rule, value)\n    return ok\n}","tryCatchPattern":"if err := util.ConfigValidate(tmpConfig); err != nil {\n    return fmt.Errorf(\"config invalid, aborting start: %w\", err)\n}","preventionTips":["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"],"tags":["config","validation","regex","semaphore"],"backgroundTag":"invalid-config-value","analyzedSha":"1774ccb71a0a8b82eb74ea24c23ac9ab713de2fa","analyzedAt":"2026-09-07T11:00:33.293Z","contentChangedAt":"2026-09-07T11:00:33.293Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}