{"record":{"id":"bf4ac15a32601e73","repo":"dapr/dapr","slug":"a-lowercase-rfc-1123-label-must-consist-of-lower-c","errorCode":null,"errorMessage":"a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is '[a-z0-9]([-a-z0-9]*[a-z0-9])?')","messagePattern":"a lowercase RFC 1123 label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character \\(e\\.g\\. 'my-name', or '123-abc', regex used for validation is '\\[a-z0-9\\]\\(\\[-a-z0-9\\]\\*\\[a-z0-9\\]\\)\\?'\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/validation/validation.go","lineNumber":86,"sourceCode":"\treturn errors.Join(errs...)\n}\n\n// The function was adapted from: https://github.com/kubernetes/apimachinery/blob/fc49b38c19f02a58ebc476347e622142f19820b9/pkg/util/validation/validation.go\nfunc regexError(msg string, fmt string, examples ...string) error {\n\tif len(examples) == 0 {\n\t\treturn errors.New(msg + \" (regex used for validation is '\" + fmt + \"')\")\n\t}\n\tmsg += \" (e.g. \"\n\tvar msgSb77 strings.Builder\n\tfor i := range examples {\n\t\tif i > 0 {\n\t\t\tmsgSb77.WriteString(\" or \")\n\t\t}\n\t\tmsgSb77.WriteString(\"'\" + examples[i] + \"', \")\n\t}\n\tmsg += msgSb77.String()\n\tmsg += \"regex used for validation is '\" + fmt + \"')\"\n\treturn errors.New(msg)\n}\n","sourceCodeStart":68,"sourceCodeEnd":88,"githubUrl":"https://github.com/dapr/dapr/blob/74ad41702745709bb15fe2114ff693b8c59bc3cc/pkg/validation/validation.go#L68-L88","documentation":"Emitted by isDNS1123Label (adapted from k8s.io/apimachinery) and wrapped by ValidateKubernetesAppID as \"invalid app id (input: '%s', service: '%s')\". On Kubernetes the app id gets a '-dapr' suffix to form the Service name (serviceName()), so the combined string must be a lowercase RFC 1123 label: only a-z, 0-9 and internal '-', must start and end alphanumeric, and at most 63 chars total — which caps the raw app id at 58 chars.","triggerScenarios":"ValidateKubernetesAppID with values like 'MyApp' (uppercase), 'my_app' (underscore), '-app' or 'app-' (leading/trailing dash), or any id longer than 58 characters because appID + '-dapr' exceeds dns1123LabelMaxLength (63).","commonSituations":"Long Helm release-prefixed app ids, uppercase team/product names used as ids, underscore-based naming conventions, or ids accepted by other platforms but invalid as Kubernetes Service names.","solutions":["Lowercase the id and replace '_' and other symbols with '-'","Shorten the id to 58 characters or fewer so the '-dapr' suffix stays within the 63-char Service name limit","Make sure the first and last characters are alphanumeric (no leading/trailing '-')","Unit-test ids against ^[a-z0-9]([-a-z0-9]*[a-z0-9])?$ plus the 58-char length cap before applying manifests"],"exampleFix":"# before\ndapr.io/app-id: \"My_Order_Processing_Service_v2\"\n# after\ndapr.io/app-id: \"my-order-processing-v2\"","handlingStrategy":"validation","validationCode":"var dns1123 = regexp.MustCompile(`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`)\n\nfunc validKubernetesAppID(appID string) error {\n\tif appID == \"\" {\n\t\treturn errors.New(\"app-id is empty\")\n\t}\n\t// serviceName(appID) appends \"-dapr\" (5 chars), capping appID at 58.\n\tif len(appID) > 58 || !dns1123.MatchString(appID) {\n\t\treturn fmt.Errorf(\"app-id %q must be a lowercase RFC 1123 label of at most 58 chars\", appID)\n\t}\n\treturn nil\n}","typeGuard":"func isDNS1123AppID(s string) bool {\n\treturn len(s) <= 58 && dns1123.MatchString(s)\n}","tryCatchPattern":null,"preventionTips":["Remember the hidden '-dapr' suffix when sizing ids: 63-char Service limit minus 5","Ban uppercase and '_' from id conventions up front","Reuse validation.ValidateKubernetesAppID as a pre-deploy unit-test assertion"],"tags":["go","dapr","kubernetes","dns-1123","app-id","validation"],"backgroundTag":null,"analyzedSha":"74ad41702745709bb15fe2114ff693b8c59bc3cc","analyzedAt":"2026-08-16T04:22:26.543Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}